Haferman Carpet

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 0, a white one by a 1.

The rules

  • 0 \rightarrow \left( \begin{array}{ccc}1&0&1\\0&1&0\\1&0&1\end{array} \right) \text{and } 1 \rightarrow \left( \begin{array}{ccc}0&0&0\\0&0&0\\0&0&0\end{array} \right)

6 iterations of the Haferman Carpet


# Python 2.7.7 Code
# Pygame 1.9.1 (for Python 2.7.7)
# Jonathan Frech 26th of February, 2016

Continue reading

White Fireworks

In the spirit of the new year, this program tries to mimic white fireworks exploding in the night sky.

The first example The second example The third example


# Python 2.7.7 Code
# Pygame 1.9.1 (for Python 2.7.7)
# Jonathan Frech 3rd of October, 2015
#         edited 1st of January, 2016

Continue reading

Spinning Shapes

Drawing lines according to length and angle, which change over time, this program creates pretty shapes. The changing values for both length and angle are saved in the image’s name.

Inwards star Spinning square Doubled Origin logo


# Python 2.7.7 Code
# Pygame 1.9.1 (for Python 2.7.7)
# Jonathan Frech  4th of December, 2015
#         edited  6th of December, 2015
#         edited 25th of December, 2015

Continue reading