Day 2
This commit is contained in:
parent
739f4a7c6d
commit
fee1f44ee0
40
day2/init.lua
Normal file
40
day2/init.lua
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
local file = io.open("input.txt")
|
||||||
|
local round_line = file:read("*l")
|
||||||
|
local old_score = 0
|
||||||
|
local new_score = 0
|
||||||
|
|
||||||
|
local old_possible_outcomes = {
|
||||||
|
["B Z"] = 9,
|
||||||
|
["A Y"] = 8,
|
||||||
|
["C X"] = 7,
|
||||||
|
["C Z"] = 6,
|
||||||
|
["B Y"] = 5,
|
||||||
|
["A X"] = 4,
|
||||||
|
["A Z"] = 3,
|
||||||
|
["C Y"] = 2,
|
||||||
|
["B X"] = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
local new_possible_outcomes = {
|
||||||
|
["B Z"] = 9,
|
||||||
|
["A Z"] = 8,
|
||||||
|
["C Z"] = 7,
|
||||||
|
|
||||||
|
["B Y"] = 5,
|
||||||
|
["A Y"] = 4,
|
||||||
|
["C Y"] = 6,
|
||||||
|
|
||||||
|
["B X"] = 1,
|
||||||
|
["A X"] = 3,
|
||||||
|
["C X"] = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
while round_line do
|
||||||
|
old_score = old_score + old_possible_outcomes[round_line]
|
||||||
|
new_score = new_score + new_possible_outcomes[round_line]
|
||||||
|
|
||||||
|
round_line = file:read("*l")
|
||||||
|
end
|
||||||
|
|
||||||
|
print(old_score)
|
||||||
|
print(new_score)
|
2500
day2/input.txt
Normal file
2500
day2/input.txt
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue