Skip to content

Commit

Permalink
Fix finding the desired shape
Browse files Browse the repository at this point in the history
Previously the function gave the desired shape as if the given shape was ours and not the opponent's.
  • Loading branch information
katzuv committed Dec 10, 2022
1 parent 1b5a254 commit bc6f747
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion puzzles/solutions/2022/d02/p2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit bc6f747

Please sign in to comment.