basically each cell has a certain number of grains of sand in it (the color represents how much is in each cell) you can add as many as you want in each cell, but if it has over 4 grains, then it will topple over and subtract 4 from its cell and add 1 to each of its 4 neighbors. numberphile does a better job explaining it but that is the general idea ===========================================HHOW TO USE: -click anywhere on the screen to add grains of sand -change the amount variable to change how much grains of sand you are adding. -change the drag variable to either make it so your can drag your mouse across the screen, but if you select 1 for the drag variable, then you can only click one cell at a time (used for more precision) -set the manual variable to make it so it will pause the simulation and only iterate through it when pressed space
I learned about this from a video by numberphile but all coding is by me ===========================================tTTHINGS TO NOTE: any symetrical starting states will (usually) have a symetrical ending state once it is all evened out