2016-03-19, post № 109

**programming**, **Pygame**, **Python**, #16777216, #256**3, #all rgb, #blue, #colors, #every rgb color, #green, #red

Listing the red part on the 𝑥-axis, the green part on the 𝑦-axis and the blue part on the 𝑧-axis, this program displays all the 𝟣𝟨𝟩𝟩𝟩𝟤𝟣𝟨 colors rgb can display.

The 𝑧-axis is shown over time, visually going through a cube of colors.

2016-03-12, post № 108

**art**, #animated, #animated gif, #beach, #board, #flip, #gif, #ocean, #surf, #surf board, #wave

The little pixel guy tries himself at surfing.

2016-03-05, post № 107

**mathematics**, **programming**, **Python**, #approx., #approximating, #approximation, #John Conway, #lambda, #number sequence, #sequence

An interesting nonmathematical sequence which yet has interesting mathematical properties is the Look-and-say sequence.

As every good sequence it starts with a 𝟣. From there you get each next entry by looking at the previous and saying it. The next entry will thus be “one 𝟣” or 𝟣𝟣. From there “two 𝟣” or 𝟤𝟣, then “one 𝟤; one 𝟣” or 𝟣𝟤𝟣𝟣, “one 𝟣; one 𝟤; two 𝟣” or 𝟣𝟣𝟣𝟤𝟤𝟣 and so on.

## Generating the Sequence

The mathematical property, although, does not lie in the entry’s value, but rather in its length.

## Calculating the Length of each Entry

The interesting thing about the length is, that it approximately grows by 𝜆 each time.

This constant 𝜆 can be calculated by getting the real root of a degree 𝟩𝟣 polynomial (see Nathaniel Johnston’s post for further information) or be approximated by dividing entries.

## Approximating 𝜆

2016-02-27, post № 106

**mathematics**, **programming**, **Pygame**, **Python**, #animated gif, #automation, #black, #black and white, #carpet, #cell, #cell simulation, #cellular, #cellular automation, #cellular simulation, #fractal, #generating, #generation, #gif, #iterations, #weave, #white, #woven

The Haferman Carpet is a fractal, which kind of looks like a woven carpet. To generate it, you start with a single black pixel and apply in each cycle a set of rules.

In each generation every pixel in the carpet will be replaced by nine pixels according to the rules. A black pixel is represented by a 𝟢, a white one by a 𝟣.

## The Rules

2016-02-20, post № 105

**programming**, **Pygame**, **Python**, #angle, #around, #filter, #image, #image filter, #image manipulation, #manipulation, #spinning, #spun, #spun around, #stir, #vector

Using a vector and an angle, rotating each pixel’s position by an angle determined by its distance to the image’s center and a constant, this filter gives the image a unique spin.

For demonstration I used — once again — an image from my post Stacking Stones.

2016-02-13, post № 104

**games**, **mathematics**, **programming**, **Pygame**, **Python**, #cells, #cell, #cell simulation, #cellular, #cellular automation, #cellular game, #cellular simulation, #John Conway, #simulation

This program is a simulation of the famous cellular automaton created by John Conway. The so-called ‘game’ is rather a simulated evolution of cells in a two-dimensional world. Each cell can either be dead (black) or alive (white) and always has eight neighbours surrounding them. In each cycle of the simulation their state will be changed based on two simple rules, which are listed below.

Despite the rule’s simplicity, the outcomes are often very interesting and complex.

For more details on the game of life, check this Wikipedia entry.

## The Rules

- A live cell can only survive with exactly 𝟤 or 𝟥 neighbours, or else it dies.
- A dead cell with exactly 𝟥 neighbours comes to life.

## Controls

- Left click turns cell at current mouse position alive,
- Right click turns cell at current mouse position dead,
- ‘r’ turns every cell dead,
- ‘q’ cycles once,
- ‘w’ cycles continuously.

2016-02-06, post № 103

**programming**, **Pygame**, **Python**, #contrast, #detection.sobel, #digital image filter, #edge, #edge detection, #filter, #image, #image filter, #img, #img filter, #J-Filter

This filter runs an edge detection algorithm on a given image.

For demonstration I used — as in my previous filter posts — an image from my post Stacking Stones.

The image with applied edge detection filter:

2016-01-30, post № 102

**programming**, **Pygame**, **Python**, #color, #mouse, #mouse controlled, #polygons, #rect, #rectangle, #rects

This program lets you spawn in a rectangle with a randomly assigned color. This rectangle will then slowly move towards the screen’s edge, eventually fading away.

## Controls

- Left click spawns in a new rectangle at current mouse position,
- ‘Space’ takes a screenshot.

Posts:

253-246, 245-238, 237-230, 229-222, 221-214, 213-206, 205-198, 197-190, 189-182, 181-174, 173-166, 165-158, 157-150, 149-142, 141-134, 133-126, 125-118, 117-110, **109-102**, 101-94, 93-86, 85-78, 77-70, 69-62, 61-54, 53-46, 45-38, 37-30, 29-22, 21-14, 13-6, 5-1Jonathan Frech's blog; built 2022/01/16 06:13:11 CET