The thing I am exploring is recursively expanding a rectangular region.
The area on the left allows you to enter text that defines an image. If I wanted to define a tower, I might start by typing:
define tower
x
x
xxx
xxx xxx
The x's get treated as black pixels, and the spaces are transparent.
The image is saved to a variable taken from the first letter of the word. So for tower, it is 't'
That allows you define something else in terms of towers. For example, a city:
define tower
x
x
xxx
xxx xxx
define city
ttt
(That would create 'tower' and a 'city' with three towers)
By itself, that is not very interesting. Slightly more interesting is allowing recursion in a definition.
That is done by following a definition by parens, and saying how many times to recur.
EG:
define tower(6 times)
For this to be work, tower must be defined in terms of itself. So instead defining a tower entirely in terms of x, you can put some t's inside, so it will recursively expand.
define tower(6 times)
x
t
xtx
xxx xxx
There are many limitations to this implementation.
- It is easy to define a scene that crashes the browser.
- It can get annoying using keeping track of single letter variable names
- recursion is limited to 9 times.
It was in Haxe and compiled to JS. It is not efficient or performant. It is entirely computed client side in JS. PNGs images are base64 encoded, and can be downloaded and saved.
what would really help if generated images are cached, as well as a debounce or a "run" button for when I'm typing in new images and old ones are getting regenerated on every keypress, that is kind of really very annoying.