local GameConfig = require(script.Parent.GameConfig)

local GridUtils = {}

function GridUtils.CellKey(x, y)
	return string.format("%d_%d", x, y)
end

function GridUtils.PlotSizeFromLevel(plotLevel)
	local level = math.max(1, math.min(GameConfig.Plot.MaxLevel, plotLevel))
	local extra = (level - 1) * GameConfig.Plot.ExpandByLevel
	return GameConfig.Plot.BaseWidth + extra, GameConfig.Plot.BaseHeight + extra
end

function GridUtils.WithinBounds(width, height, x, y)
	return x >= 1 and y >= 1 and x <= width and y <= height
end

return GridUtils
