Abelian sandpile model: Difference between revisions

m
imported>RegalCode
(Implementation for Abelian sand pile)
 
(One intermediate revision by one other user not shown)
Line 69:
simulate(&grid)
 
V ppm = File(‘sand_pile.ppm’, ‘w’WRITE)
ppm.write_bytes(("P6\n#. #.\n255\n".format(grid.len, grid.len)).encode())
V colors = [[Byte(0), 0, 0],
Line 377:
BEGIN
INT result := s[ 1 LWB s, 2 LWB s ];
FOR i FROM 1 LWB s TO 21 UPB s DO
FOR j FROM 2 LWB s TO 2 UPB s DO
IF s[ i, j ] > result THEN result := s[ i, j ] FI
3,028

edits