Leveling system

This commit is contained in:
Alexey 2025-06-25 16:51:23 +03:00
commit efe9f386bd
6 changed files with 83 additions and 26 deletions

View file

@ -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