A crack at some simple generative art, using PyCairo for illustration. "Turtles" can iteratively draw paths - throwback to one of the first computer science courses I ever took!
snake.py - Turtles that have probabilisticly decide to turn or branch off another turtle. Different thresholds for turning, branching, different starting turtle "seeds", and different turn angles generate very different images!
spiral.py - Turtles that spiral around! Turtles will quickly collide into edges or other spirals. Currently allows "phasing" - where turtles are allowed to pass through boundaries without drawing for a limited number of steps. Idea for the future: have turtles just make a 180 degree turn (with some width) if they hit something...
Install dependencies using Poetry:
poetry installpoetry run -m python snake.pyTo start, just some 90 degree turns:
Next, let's go to 45 degree turns. These are some of my favorites. Sparser ones look like metro systems, denser ones look very PCB-esque.
If we go to 10 degree turns, we get something more like old city streets. Or, if we go to random turn lengths, something more like blood vessels.
Now let's try some spirals! These turtles are allowed to pass through boundaries until they can resume their spiral.
If we allow branching on spirals, it gets pretty wild. Low branching probabilities makes this a bit more sane.














