From bc6f747e892e32397fa064f5e218f5d65bb5ee26 Mon Sep 17 00:00:00 2001 From: Dan Katzuv Date: Sat, 10 Dec 2022 21:47:17 +0200 Subject: [PATCH] Fix finding the desired shape Previously the function gave the desired shape as if the given shape was ours and not the opponent's. --- puzzles/solutions/2022/d02/p2.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/puzzles/solutions/2022/d02/p2.py b/puzzles/solutions/2022/d02/p2.py index e7948f1..9539cfa 100644 --- a/puzzles/solutions/2022/d02/p2.py +++ b/puzzles/solutions/2022/d02/p2.py @@ -11,7 +11,9 @@ def choose_shape(opponent_move: str, outcome: str) -> str: :return: shape to play for the desired outcome to happen """ mapping = shapes.OUTCOME_TO_MAPPING[outcome] - return mapping[opponent_move] + for our_move in mapping: + if mapping[our_move] == opponent_move: + return our_move def generate_moves(