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.
# Python 2.7.7 Code # Pygame 1.9.1 (for Python 2.7.7) # Jonathan Frech 26th of February, 2016