diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-08-25 18:44:28 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-08-25 18:44:28 +0100 |
commit | 08bca7b68ebf3cb994644d427c447d0b44cde7c3 (patch) | |
tree | f0204e4b87d02173f5fba2c1485feb1c718abc58 /main.c | |
parent | e6fc32ef086028b787d97797b464e172dfded76f (diff) | |
download | abelian-sandpile-08bca7b68ebf3cb994644d427c447d0b44cde7c3.tar.gz abelian-sandpile-08bca7b68ebf3cb994644d427c447d0b44cde7c3.tar.bz2 abelian-sandpile-08bca7b68ebf3cb994644d427c447d0b44cde7c3.zip |
(main)+colouring for differing sandpile proportions
Based on Wikipedia page colouring.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -61,8 +61,19 @@ int main(void) for (size_t i = 0; i < state.dwidth; ++i) for (size_t j = 0; j < state.dwidth; ++j) { + Color c = {0}; + unsigned char sandpile = state.data[(i * state.dwidth) + j]; + if (sandpile == 0) + c = BLACK; + else if (sandpile == 1) + c = GREEN; + else if (sandpile == 2) + c = PURPLE; + else if (sandpile == 3) + c = YELLOW; + DrawRectangle(i * state.multiplier, j * state.multiplier, - state.multiplier, state.multiplier, BLACK); + state.multiplier, state.multiplier, c); } EndDrawing(); } |