Abelian sandpile model: Difference between revisions
Content added Content deleted
m (→{{header|FutureBasic}}: fix filename2) |
(add PicoLisp) |
||
Line 3,025: | Line 3,025: | ||
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span> |
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span> |
||
<!--</syntaxhighlight>--> |
<!--</syntaxhighlight>--> |
||
=={{header|PicoLisp}}== |
|||
<syntaxhighlight lang="picolisp"> |
|||
(load "@lib/simul.l") |
|||
(symbols 'simul 'pico) |
|||
(de sandpile (A B) |
|||
(let |
|||
(Grid (grid A A) |
|||
Size (/ (inc A) 2) |
|||
Center (get Grid Size Size) |
|||
Done T ) |
|||
(for G Grid |
|||
(for This G |
|||
(=: V 0) ) ) |
|||
(with Center |
|||
(=: V B) |
|||
(while Done |
|||
(off Done) |
|||
(for G Grid |
|||
(for This G |
|||
(when (>= (: V) 4) |
|||
(=: V (- (: V) 4)) |
|||
(on Done) |
|||
(mapc |
|||
'((Dir) |
|||
(with (Dir This) (=: V (inc (: V)))) ) |
|||
'(north south west east) ) ) ) ) ) ) |
|||
(disp Grid 0 |
|||
'((This) (if (: V) (pack " " @ " ") " ")) ) ) ) |
|||
(sandpile 10 64) |
|||
</syntaxhighlight> |
|||
=={{header|Python}}== |
=={{header|Python}}== |