Stopped adding a grain of sand per step. Collapsing should work properly for any amount of sand grains, regardless of whether it's 4 or 4000. Previous code fixed it at 4 always, and how it distributed was so as well. Now we distribute as much sand as we can. This comes from the idea that, instead of incrementing while rendering, let's just set some n pixels in the centre and see how the model distributes them.
24 lines
363 B
C
24 lines
363 B
C
#ifndef LIB_H
|
|
#define LIB_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
|
|
typedef struct State
|
|
{
|
|
// Sandpiles
|
|
uint64_t *data;
|
|
size_t dwidth;
|
|
|
|
size_t window_len;
|
|
int multiplier;
|
|
|
|
bool thread_alive;
|
|
} state_t;
|
|
|
|
bool load_from_file(state_t *state, const char *filepath);
|
|
bool write_to_file(state_t *state, const char *filepath);
|
|
|
|
#endif
|