feat: solve day 2 puzzle 1
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user