Helps to actually commit the code

This commit is contained in:
Thomas Muller 2023-12-03 13:20:24 -05:00
parent 7c29291c0f
commit 00411149e6

View file

@ -141,6 +141,29 @@ net.Receive("AOC:Part2", function()
local ent = net.ReadEntity()
local input = net.ReadString()
print('Part 2')
print(input)
local power_sum = 0
for i, line in pairs(split(input, '\n')) do
local game = parseGame(line)
print('Game '..game.id)
local min_red_needed = 0
local min_grn_needed = 0
local min_blu_needed = 0
for i, play in pairs(game.draws) do
print(' play '..i)
print(' red: '..play.red)
print(' grn: '..play.green)
print(' blu: '..play.blue)
if play.red > min_red_needed then min_red_needed = play.red end
if play.green > min_grn_needed then min_grn_needed = play.green end
if play.blue > min_blu_needed then min_blu_needed = play.blue end
end
local power = min_red_needed * min_grn_needed * min_blu_needed
print(' power '..power)
power_sum = power_sum + power
end
print('Sum of powers: '..power_sum)
end)