-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrps_logic.py
37 lines (31 loc) · 1.05 KB
/
rps_logic.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# def match_card(read_card):
# to_play = None # default value in case reading fails, this can be used to raise an error later
# match read_card:
# case "rock_card":
# to_play = "paper_block"
# case "paper_card":
# to_play = "scissor_block"
# case "scissors_card":
# to_play = "rock_block"
# case _:
# print("Invalid input")
#
# print(f"The read card is {read_card}. \nThe block to play is {to_play}.")
#
# return to_play
def match_card(read_card):
to_play = None # default value in case reading fails, this can be used to raise an error later
if read_card == "rock_card":
to_play = "paper_block"
elif read_card == "paper_card":
to_play = "scissor_block"
elif read_card == "scissor_card":
to_play = "rock_block"
else:
print("Invalid input")
print(f"The read card is {read_card}. \nThe block to play is {to_play}.")
return to_play
def main():
match_card("scissors_card")
if __name__ == "__main__":
main()