Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function doWave(g, x, y)
- checkCell(g, x+1, y, g[x][y].len + 1)
- checkCell(g, x-1, y, g[x][y].len + 1)
- checkCell(g, x, y+1, g[x][y].len + 1)
- checkCell(g, x, y-1, g[x][y].len + 1)
- doWave(g, x+1,y)
- doWave(g, x-1,y)
- doWave(g, x,y+1)
- doWave(g, x,y-1)
- end
- function checkCell(g, x, y, len)
- if x < 1 then return end
- if x > gridSize then return end
- if y < 1 then return end
- if y > gridSize then return end
- if g[x][y].type == TYPE_SEARCHED then return end
- if g[x][y].type == TYPE_SOLID then return end
- g[x][y].type = TYPE_SEARCHED
- g[x][y].len = len
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement