Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function getCell(x, y)
- if grid[x] ~= nil then if grid[x][y] ~= nil then return grid[x][y] end end
- return nil
- end
- local function checkCell(x,y)
- local coords = { { {-1, 0}, {-1, -1}, {0, -1}}, { {-1, 0}, {-1, 1}, {0, 1} }, { {0, 1}, {1, 1}, {1, 0} }, { {1, 0}, {1, -1}, {0, -1} } }
- local ok = false
- for i=1,#coords do
- local n = 0
- local coord = coords[i]
- for j=1,#coord do
- local co = coord[j]
- --n = n + 1
- if getCell(unpack(co)) == 1 then n = n + 1 end
- end
- if n == #coord then
- ok = true
- end
- end
- return ok
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement