Generative Pills #1: Snakeline Drawings

[This is the first post of a serie dedicated to some ideas of generative art (graphics and music)]

I’ve always been a fan of the videogame Nibbler  and other snake-like videogames (I also “played” with them theoretically … but this is a total different story 😉 ). But can the concept be used for generative art? I had an idea and set up a quick sketch in which many colored snakes freely run around the screen, random food blocks are placed on the screen and whenever a snake eats a food its length increses, when a snake hits another snake or its own tail it tries to change direction … but the result was not so promising; this is an image of the sketch:

Then I tried using a simple line to draw the snake and use another set of rules:


  • a set of “snakes” (drawn as lines) are randomly placed on the screen
  • each snake:
    • has a random color. The color is picked from a finite palette for better results.
    • can move horizontally/vertically/diagonally (for mor interesting results, some of them can move only horizontally/vertically)
    • has a preferred rotation angle (clockwise or counterclockwise)
  • when a snake moves its length increases
  • if a snake hits another snake or its own tail, it tries to rotate and
    continue its run (or stops moving)

… and “magically” the results became more interesting:

I don’t know if its original: the dynamics is similar to the Tron bikes race  and I also found a method to generate paintings in the style of Piet Mondrian by Michael Fogleman (2011), but the results are quite different. So let me know in the comments if someone else has already used this technique.

I used the Snakeline Drawings algorithm to make some videos (please subscribe to my channel):

A showcase of images produced by the algorithm.

A “fractal” tribute to Bach …


The source code can be downloaded here:

snakeline v1.0 source code


Memories of an Electric Sheep

A simulation of the brain activity of an electric sheep: it dynamically combines some of the best paintings ever created.

The memory evolves and the combinations are endless and unique. With a little bit of patience, weird artistic “anachronisms” can arise: an old japanese boat sailing in Venice, a sleeping hawaiian in front of Plato and Aristotle, a clock near the animals in a prehistoric cave …

The animation was exhibited at PDC@Coimbra 2021 a Processing Community Day initiative supported by the Processing Foundation with the goal of celebrating art, code and diversity while promoting creative coding and computational thinking as tools for creative students, researchers and professionals. The theme of the exhibition was “Anachronism”.

The soundscape is purely generative (made in VCV Rack).

The source code can be downloaded here: sheepmemories2.7z


The Endless Tale … (Asemic Writing animation)

From Wikipedia:

Asemic Writing is a wordless open semantic form of writing. The word asemic means “having no specific semantic content”, or “without the smallest unit of meaning”. With the non-specificity of asemic writing there comes a vacuum of meaning, which is left for the reader to fill in and interpret. …. Asemic writing is a hybrid art form that fuses text and image into a unity, and then sets it free to arbitrary subjective interpretations. …

Inspired by a challenge launched by Robert Boran on the Facebook group Creative Coding with Processing and P5.js I created a Processing sketch that simulates an Asemic Writing. The technique is based on a sequence of eight random “words” that alternates randomly; each “word” is a combination of “elliptic oscillators” that follows the rectlinear movement of the (hidden) pen on the page.

The animation is accompained by a simple purely generative soundscape made with VCV Rack and Native Instruments Absynth VST.

This is the final result.

As soon as I clean-up a little bit the code (actually a mess) I’ll publish it here and add more details.