Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function checkCellSquare(x, y)
- local n = 0
- for xo=-1,1,2 do
- for yo=-1,1,2 do
- if getCell(x+xo, y) == 1 then n = n + 1 end
- if getCell(x, y+yo) == 1 then n = n + 1 end
- if getCell(x+xo, y+yo) == 1 then n = n + 1 end
- end
- end
- return n
- 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
- if getCell(x, y) == 1 then
- 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(co[1]+x, co[2]+y) == 1 then n = n + 1 end
- end
- if n == #coord then
- ok = true
- end
- end
- end
- if ok then ok = (checkCellSquare(x,y) == 3) end
- return ok
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement