summaryrefslogtreecommitdiff
path: root/abellian_sandpile.c
diff options
context:
space:
mode:
authorTannerRobison <[email protected]>2026-07-13 06:34:43 +0000
committerTanner Robison <[email protected]>2026-07-14 19:27:18 -0700
commit6577467c897d79a6bd2b19ddde2dd12eaef6f228 (patch)
tree1f5ad2e1947cc6d6e135c8276f5fe790372f3509 /abellian_sandpile.c
parentf139bf96eb735a584c013f61f2d1922e20677da2 (diff)
Update LICENSE
Diffstat (limited to 'abellian_sandpile.c')
-rw-r--r--abellian_sandpile.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/abellian_sandpile.c b/abellian_sandpile.c
index 5293cae..321f53a 100644
--- a/abellian_sandpile.c
+++ b/abellian_sandpile.c
@@ -60,15 +60,18 @@ int main() {
fprintf(stderr, "Failed to initialize grid");
}
- uint32_t time_steps = 4000000000; //4 billion time steps
- for (int i = 0; i < time_steps; i++) {
+ uint8_t render_count = 100; //100 renders
+ uint32_t render_gap = 100000; //renders every 100k time steps
+ for (uint8_t i = 0; i < render_count; i++) {
// drop a 'grain' of sand of top of sandpile
- for (int j = 0; j < 100000; j++) {
+ for (uint32_t j = 0; j < render_gap; 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);
+ uint64_t current_step = (uint32_t)i * render_gap;
+ printf("time step: %u", (unsigned int)current_step);
+
printf(CLEAR_GRID);
render(terminal_height, terminal_width, positions, new_positions);
}