jblog
toc

Menger Sponge

2015-07-25, post № 49

programming, Pygame, Python, #black, #blue, #divide, #endless, #fractal, #infinite, #sponge

Normally, the Menger Sponge is a three-dimensional cuboid. This program works in a two-dimensional space, so it only shows one side of the sponge.
Because a computer has its capacities, I capped the maximum square count to 𝟣𝟢𝟢𝟢𝟢. After that maximum, the face will not be complete.

Controls

  • ‘Space’ divides every square once again.
menger-sponge-1.png
menger-sponge-2.png
menger-sponge-3.png
menger-sponge-4.png
menger-sponge-5.png
Source code: menger-sponge.py