feat: solve day 2 puzzle 1

This commit is contained in:
2025-12-02 11:40:10 +01:00
parent e1623ac0fa
commit fccf6464ba
6 changed files with 57 additions and 5 deletions

View File

@@ -78,14 +78,18 @@ function utils.waitForKey(targetKey)
end
end
function utils.splitLines(data)
function utils.split(data, sep)
local t = {}
for str in string.gmatch(data, "([^\n]+)") do
for str in string.gmatch(data, "([^" .. sep .. "]+)") do
table.insert(t, str)
end
return t
end
function utils.splitLines(data)
return utils.split(data, "\n")
end
function utils.round(x)
return x >= 0 and math.floor(x + 0.5) or math.ceil(x - 0.5)
end