Hacker News new | past | comments | ask | show | jobs | submit login

https://hachyderm.io/@bazzargh/111891925700326448

writing code for the bbc microbot has always been a fun challenge - you have to fit your code inside a toot (formerly a tweet) tho it does have some tricks to help you compress the tokens a bit. Sometimes you'd just use the basic geometrical figures available in bbc basic to put together a picture, like the man in this version of the Vertigo poster: https://bbcmic.ro/?t=7uzei or everything but the letters in this Two Tone label: https://bbcmic.ro/?t=6UNhz

... but even when that gets to need a bit of trickery to fit in enough geometry, like this one, "This is Fine" https://bbcmic.ro/?t=6XGKK it's not that interesting to just have a table of shapes. What I like to do is try to fit 2 or more less obvious ideas into the code as well as the drawing, so with the "This is Fine" piece it's the little bit of maths that makes the piecewise circular curves smooth, in the Vertigo poster it's producing the curve in the same way Saul Bass did (with a pendulum), or the multiple letter sizes and xor plotting in the Two Tone label.

The Dragon in the first link tho seems improbaly complex because there's not a lot of code and none of it is table-driven. The core idea is that repetition makes a good subject for compact code to generate art; the dragon may look complex but the scales repeat so the body is just many identical segments and both the head and body have axial symmetry. The snakelike body needed to be curvy, but if it curves too sharply the segments would be split on one side and crushed on the other. I'd done some code previously working on Dubins Paths (https://en.wikipedia.org/wiki/Dubins_path) and realised that'd be a good fit - just use a single curvature and flip between curving left and right. I found a good set of random numbers to generate a body with that just by experimentation. The scales I knew the effect I was going for and tried both sine waves and circles in various combinations till I found one that looked scaly; then I just needed to repeat it.

The head proved difficult; I'd tried other things like the fractal I used for the wave in this Hokusai recreation https://bbcmic.ro/?t=aAh0m the "Christmas Tree" fractal used to make this Rudolf https://bbcmic.ro/?t=6TR6f and other things, but none were really working or took too much code. What I landed on was just using sin/cos to vary the radius around a circle, which made a spiky head shape, then wobblying the angle plotted at to make it less uniform. The nose and eyes were just selectively not plotting some pixels, and that accidentally created the glowing rays from the eyes and the wrinkles; serendipity is great.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: