aboutsummaryrefslogtreecommitdiffstats
path: root/AoC2022/02
diff options
context:
space:
mode:
Diffstat (limited to 'AoC2022/02')
-rw-r--r--AoC2022/02/solver.jl10
1 files changed, 5 insertions, 5 deletions
diff --git a/AoC2022/02/solver.jl b/AoC2022/02/solver.jl
index b93a88f..0516fc7 100644
--- a/AoC2022/02/solver.jl
+++ b/AoC2022/02/solver.jl
@@ -2,7 +2,7 @@ using Match
using Test
plays = open("input") do f
- split.(eachsplit(read(f, String),"\n", keepempty=false))
+ split.(eachsplit(read(f, String), "\n", keepempty = false))
end
translate(play) = @match play begin
@@ -11,7 +11,7 @@ translate(play) = @match play begin
"C" || "Z" => :scissors
end
-weigth(play)= @match play begin
+weigth(play) = @match play begin
:rock => 1
:paper => 2
:scissors => 3
@@ -58,12 +58,12 @@ function reactive_play(oponent, my)
"Y" => oponent_hand
"Z" => looses(oponent_hand) # I win
_ => error("Invalid input")
- end
+ end
points(my_hand, oponent_hand) + weigth(my_hand)
end
@testset "solutions" begin
- @test map(((op, my),) -> fixed_play(op,my), plays) |> sum == 12535
- @test map(((op, my),) -> reactive_play(op,my), plays) |> sum == 15457
+ @test map(((op, my),) -> fixed_play(op, my), plays) |> sum == 12535
+ @test map(((op, my),) -> reactive_play(op, my), plays) |> sum == 15457
end