Simple C implementation of the RandomArt generation algorithm described on this paper. It was also majorly inspired by Tsoding's implementation, so thanks for the idea!!!
Install CMake, then run:
cd build
cmake ..
make
The randomart
executable will be placed under the build
directory.
You should read the paper (and Tsoding's skeet) for a proper explanation, but the tl;dr of the algorithm is:
- Generate a random AST describing a function which takes as input a pair of XY coordinates and returns a triple of RGB values, these values being in the range [-1, 1];
- Run this AST for every pixel on your image;
- Ta-da!
Generated through the following function:rgb(x, mul(x, mul(add(y, add(add(y, y), mul(y, y))), 0.451108)), add(x, add(add(mul(x, y), mul(y, y)), x)))
Check examples.md
for some nifty example images!