diff options
| author | Tanner Robison <[email protected]> | 2026-06-21 22:04:51 -0700 |
|---|---|---|
| committer | Tanner Robison <[email protected]> | 2026-06-21 22:05:04 -0700 |
| commit | bbeed2571743df0a2163682a83f48889cf218288 (patch) | |
| tree | 2377bcdc05b0d3dd70b9fa2f10a52bbe2d3d3ad5 | |
| parent | 79d6a4cecbf2e78180e5860af7252aa6f16de0a7 (diff) | |
ASCII frame (not working yet)
| -rw-r--r-- | README.md | 3 | ||||
| -rwxr-xr-x | abellian_sandpile | bin | 0 -> 16176 bytes | |||
| -rw-r--r-- | abellian_sandpile.c | 44 |
3 files changed, 46 insertions, 1 deletions
@@ -1,2 +1,3 @@ # Abelian Sandpile model - +## compile command: +gcc -Wall abellian_sandpile.c -o abellian_sandpile $(pkg-config --cflags --libs sdl2) -lm diff --git a/abellian_sandpile b/abellian_sandpile Binary files differnew file mode 100755 index 0000000..c9c8345 --- /dev/null +++ b/abellian_sandpile diff --git a/abellian_sandpile.c b/abellian_sandpile.c new file mode 100644 index 0000000..09197d6 --- /dev/null +++ b/abellian_sandpile.c @@ -0,0 +1,44 @@ +#include <asm-generic/ioctls.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/ioctl.h> + +#define CLEAR_GRID "\033[0m" +#define COLOR_RED "\033[31m" // cell value 4 +#define COLOR_ORANGE "\033[31m" // cell value 3 +#define COLOR_YELLOW "\033[31m" // cell value 2 +#define COLOR_WHITE "\033[31m" // cell value 1 + +int positions[HEIGHT][WIDTH]; +int new_positions[HEIGHT][WIDTH]; + +int + + void + init_grid(); +void draw_new_positions(); +void render(); + +int main() { + // gets terminal window size + struct winsize w; + ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); + + printf("starting abellian sandpile simulation\n"); + init_grid(); + printf("\ninitialized grid"); + return 0; +} + +void init_grid() { + for (int i = 0; i < HEIGHT; i++) { + for (int j = 0; j < WIDTH; j++) { + printf(" "); + + // prints a X around the borders + if (j = (WIDTH - 1)) { + printf("|"); + } + } + } +} |
