Skip to content

PBnJK/randomart

Repository files navigation

RandomArt

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!!!

Building

Install CMake, then run:

cd build
cmake ..
make

The randomart executable will be placed under the build directory.

Explanation

You should read the paper (and Tsoding's skeet) for a proper explanation, but the tl;dr of the algorithm is:

  1. 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];
  2. Run this AST for every pixel on your image;
  3. Ta-da!

Colorful output of the RandomArt algorithm

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)))

Examples

Check examples.md for some nifty example images!

About

Inspired by tsoding's randomart and the original paper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages