Leveling system
This commit is contained in:
parent
362a4e39ee
commit
efe9f386bd
6 changed files with 83 additions and 26 deletions
14
grid.lua
14
grid.lua
|
|
@ -1,4 +1,3 @@
|
|||
require 'tablefuncs'
|
||||
require 'config'
|
||||
require 'point'
|
||||
|
||||
|
|
@ -107,3 +106,16 @@ end
|
|||
function Grid:inBounds( point )
|
||||
return point.x <= self.size.x and point.y <= self.size.y
|
||||
end
|
||||
|
||||
-- Checks if all lines have been connected and all dots are fulfilled
|
||||
---@return boolean
|
||||
function Grid:isCompleted()
|
||||
local requiredCount, totalCount = self.size.x * self.size.y, 0
|
||||
for _, line in ipairs( self.lines ) do
|
||||
if not line:endpointsConnected() then
|
||||
return false
|
||||
end
|
||||
totalCount = totalCount + #line.points
|
||||
end
|
||||
return totalCount == requiredCount
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue