Implementation of the Wave Function Collapse algorithm as a header only solution in C99. If you want to learn about the algorithm I suggest you to check out the original implementation here. The image samples are taken from the original repo.
To acces the implementation details you need to define WFC_APPLICATION before including the wfc.h header file.
#define WFC_APPLICATION
#include "wfc.h"
You should only define WFC_APPLICATION in a single translation unit.
The only real dependency of wfc.h is utopia, a generic data structure and header-only library in C.
The demonstration program depends on imgtool, a simple wrapper around PNG, JPEG, and other formats to save and load images easily, and spxe, a simple pixel engine to render the output in real time with OpenGL.
On Linux and MacOS:
git clone --recursive https://github.com/LogicEu/wfc.git
cd wfc
make # or ./build.sh all
./wfc --help