diff options
| -rw-r--r-- | README.md | 3 | ||||
| -rwxr-xr-x | abellian_sandpile | bin | 16088 -> 16088 bytes | |||
| -rw-r--r-- | abellian_sandpile.c | 19 |
3 files changed, 14 insertions, 8 deletions
@@ -1 +1,4 @@ # Abelian Sandpile model + +Highly recommend to lower font size for the simulation, But keep in mind the lower +the font size the longer it takes to see results diff --git a/abellian_sandpile b/abellian_sandpile Binary files differindex 88df3e2..592bc2e 100755 --- a/abellian_sandpile +++ b/abellian_sandpile diff --git a/abellian_sandpile.c b/abellian_sandpile.c index 3117b0d..5293cae 100644 --- a/abellian_sandpile.c +++ b/abellian_sandpile.c @@ -60,12 +60,15 @@ int main() { fprintf(stderr, "Failed to initialize grid"); } - uint32_t time_steps = 20000000; + uint32_t time_steps = 4000000000; //4 billion time steps for (int i = 0; i < time_steps; i++) { // drop a 'grain' of sand of top of sandpile - positions[10][60] += 1; - get_new_positions(terminal_height, terminal_width, positions, - new_positions); + for (int j = 0; j < 100000; j++) { + positions[terminal_height / 2][terminal_width / 2] += 1; + get_new_positions(terminal_height, terminal_width, positions, + new_positions); + } + printf("time step: %u", (unsigned int)time_steps); printf(CLEAR_GRID); render(terminal_height, terminal_width, positions, new_positions); } @@ -120,13 +123,13 @@ int render(int height, int width, int (*positions)[width], if (new_positions[i][j] == 0) { printf(" "); // Empty cell } else if (new_positions[i][j] == 1) { - printf(COLOR_WHITE "."); // Cell with value 1 + printf(COLOR_WHITE "o"); // Cell with value 1 } else if (new_positions[i][j] == 2) { - printf(COLOR_YELLOW "o"); // Cell with value 2 + printf(COLOR_YELLOW "0"); // Cell with value 2 } else if (new_positions[i][j] == 3) { - printf(COLOR_ORANGE "0"); // Cell with value 3 + printf(COLOR_ORANGE "@"); // Cell with value 3 } else if (new_positions[i][j] >= 4) { - printf(COLOR_RED "4"); // Cell with value 4 or more + printf(COLOR_RED "#"); // Cell with value 4 or more } } printf("\n"); // Move to the next line after each row |
