Percolation/Bond percolation: Difference between revisions
m
→{{header|11l}}: named tuples
m (Reformatting text.) |
Alextretyak (talk | contribs) m (→{{header|11l}}: named tuples) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 32:
R Int(:seed >> 16) / Float(FF'FF)
T Grid = ([[Int]] cell, [[Int]] hwall, [[Int]] vwall)▼
▲ [[Int]] cell, hwall, vwall
V (M, nn, t) = (10, 10, 100)
Line 66 ⟶ 61:
print(‘!) ’(‘ ’ * where)‘ ’f[1])
F flood_fill(m, n, &cell, hwall, vwall) ->
cell[n][m] = 1
I n < :nn - 1 & !hwall[n + 1][m] & !cell[n + 1][m]
flood_fill(m, n + 1, &cell, hwall, vwall)
E I n == :nn - 1 & !hwall[n + 1][m]
X.throw PercolatedException((m, n + 1))
I m & !vwall[n][m] & !cell[n][m - 1]
flood_fill(m - 1, n, &cell, hwall, vwall)
Line 2,445 ⟶ 2,440:
{{trans|Kotlin}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="
import "./fmt" for Fmt
var rand = Random.new()
|