diff options
-rw-r--r-- | README.md | 14 | ||||
-rwxr-xr-x | build.sh | 13 | ||||
-rw-r--r-- | demo/demo.png | bin | 0 -> 301 bytes | |||
-rwxr-xr-x | ppmtopng.sh | 1 | ||||
-rw-r--r-- | src/main.c | 2 |
5 files changed, 27 insertions, 3 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..e20a0ff --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +### Wave function collapse + +This an implementation of very primitive tile-based wave function collapse. +It uses tiles to generate an image, similar to this: +![Demo of the program](demo/demo.png) + +It generates the tiles as ppm, then generates the image, similar to the demo image as ppm. There is a script to turn the ppm files into png using imagemagick. + +All files including the tiles are saved in the files directory + +### Build + +To build use `./build.sh` +To build and run use `./build.sh run` @@ -9,6 +9,12 @@ ODIR="obj" BIN="bin" VALGRND="" +RUN=0 + +function run { + RUN=1 +} + function leak { VALGRND="valgrind --leak-check=full" } @@ -37,5 +43,8 @@ gcc -o $BIN/wfc $ODIR/main.o $ODIR/ppm.o $ODIR/tiles.o $FLAGS gcc -o $BIN/gen_tiles $ODIR/gen_tiles.o $ODIR/ppm.o $FLAGS -$VALGRND $BIN/gen_tiles -$VALGRND $BIN/wfc +if ! { [[ $RUN -eq 0 ]]; } 2> /dev/null +then + $VALGRND $BIN/gen_tiles + $VALGRND $BIN/wfc +fi diff --git a/demo/demo.png b/demo/demo.png Binary files differnew file mode 100644 index 0000000..82498c6 --- /dev/null +++ b/demo/demo.png diff --git a/ppmtopng.sh b/ppmtopng.sh index e415a5f..df33236 100755 --- a/ppmtopng.sh +++ b/ppmtopng.sh @@ -1,5 +1,6 @@ #!/bin/sh +cd ${0%/*} # go to project root set -xe for i in files/file*.ppm @@ -120,7 +120,7 @@ int main(void) { time_t seed = time(0); srand(seed); - printf("seed %ld\n", seed); + printf("The Seed is %ld\n", seed); init_tiles_board(); |