summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanner Robison <[email protected]>2026-06-28 15:14:27 -0700
committerTanner Robison <[email protected]>2026-06-28 15:14:27 -0700
commit85e57d82555e435365c58b25523104a4547fc1d7 (patch)
tree67275071532dba00a0cea9f07c9d98c4600eb1fb
parentbbeed2571743df0a2163682a83f48889cf218288 (diff)
Added Make file
also made changes to the main program but will be emphasized in a future commit
-rw-r--r--Makefile8
-rwxr-xr-xabellian_sandpilebin16176 -> 16176 bytes
-rw-r--r--abellian_sandpile.c34
3 files changed, 25 insertions, 17 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6943f7f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,8 @@
+CC = gcc
+Cflags = -I.
+
+abellian_sandpile:
+ $(CC) -o abellian_sandpile abellian_sandpile.c
+
+clean:
+ rm -f abellian_sandpile
diff --git a/abellian_sandpile b/abellian_sandpile
index c9c8345..95132c3 100755
--- a/abellian_sandpile
+++ b/abellian_sandpile
Binary files differ
diff --git a/abellian_sandpile.c b/abellian_sandpile.c
index 09197d6..ec6966b 100644
--- a/abellian_sandpile.c
+++ b/abellian_sandpile.c
@@ -9,36 +9,36 @@
#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];
+#define WIDTH 40
+#define HEIGHT 40
-int
-
- void
- init_grid();
-void draw_new_positions();
-void render();
+int init_grid(int positions[HEIGHT][WIDTH]);
+int draw_new_positions();
+int render();
int main() {
// gets terminal window size
struct winsize w;
- ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
+ // ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
+
+ int positions[HEIGHT][WIDTH];
+ int (*ppositions)[] = positions;
+ int new_positions[HEIGHT][WIDTH];
printf("starting abellian sandpile simulation\n");
- init_grid();
+ init_grid(ppositions);
printf("\ninitialized grid");
return 0;
}
-void init_grid() {
+int init_grid(int positions[HEIGHT][WIDTH]) {
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("|");
- }
+ positions[i][j] = 0;
+ printf("%d", positions);
}
+ printf("\n");
}
+
+ return 0;
}