forked from mouredev/retos-programacion-2023
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mouredev.py
30 lines (24 loc) · 1.06 KB
/
mouredev.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
def rock_paper_scissor_lizard_spock(games):
rules = {"🗿": ["✂️", "🦎"],
"📄": ["🗿", "🖖"],
"✂️": ["📄", "🦎"],
"🦎": ["🖖", "📄"],
"🖖": ["🗿", "✂️"]}
player_one = 0
player_two = 0
for game in games:
player_one_game = game[0]
player_two_game = game[1]
if player_one_game != player_two_game:
if player_two_game in rules[player_one_game]:
player_one += 1
else:
player_two += 1
return "Tie" if player_one == player_two else "Player 1" if player_one > player_two else "Player 2"
print(rock_paper_scissor_lizard_spock([("🗿", "🗿")]))
print(rock_paper_scissor_lizard_spock([("🗿", "✂️")]))
print(rock_paper_scissor_lizard_spock([("✂️", "🗿")]))
print(rock_paper_scissor_lizard_spock(
[("🗿", "🗿"), ("🗿", "🗿"), ("🗿", "🗿"), ("🗿", "🗿")]))
print(rock_paper_scissor_lizard_spock(
[("🖖", "🗿"), ("✂️", "📄"), ("🗿", "🗿"), ("🦎", "🖖")]))