Anonymous user
Percolation/Site percolation: Difference between revisions
Added Julia language
(Added Julia language) |
(Added Julia language) |
||
Line 994:
NOT_VISITED = 1 # const
N, M = size(grid)
dirs = [[1, 0], [-1, 0], [0, 1], [1, 0]]
# fill cell
grid[r, c] = indx
if r < N && grid[r+1, c] == NOT_VISITED▼
# for each direction, if has not reached the bottom yet and can continue go to that direction
rst = walkmaze!(grid, r + 1, c, indx)▼
end▼
▲ end
end
return rst
Line 1,034 ⟶ 1,027:
function printgrid(G::Matrix{Int})
LETTERS = vcat(' ', '#', 'A':'Z')
for r in 1:size(G, 1)
|