Abelian sandpile model: Difference between revisions

Added description.
(Added description.)
Line 1,397:
 
=={{header|Nim}}==
Our program uses Rust algorithm (and also its colors 🙂) and the formula to compute grid size from number of particles comes from Pascal algorithm.
Number of particles is an input from user. The program displays the values on the terminal if there are not too many and produce a PNG image. Code to produce a PPM image is also provided but not used.
<lang Nim>
# Abelian sand pilesandpile.
 
from math import sqrt
Line 1,406 ⟶ 1,408:
from strutils import strip, addSep, parseInt
 
# The grid represented as ana arraysequence of arrayssequences of int32.
type Grid = seq[seq[int32]]
 
Line 1,540 ⟶ 1,542:
 
# Display grid.
if grid.len <= 4020:
grid.display(initVal)
#grid.writePpmFile(fmt"grid_{initVal}.ppm")
Anonymous user