Skip to content

Instantly share code, notes, and snippets.

@asdkant
Last active April 17, 2018 14:20
Show Gist options
  • Save asdkant/404e776c39b73633fff4c5e756aedb47 to your computer and use it in GitHub Desktop.
Save asdkant/404e776c39b73633fff4c5e756aedb47 to your computer and use it in GitHub Desktop.
borrador python RPS
play_types = {1:"Piedra",2:"Papel",3:"Tijera"}
def get_play(playernum):
play = int(input(f"""Juigada jugador {playernum}:
1) {play_types[1]}
2) {play_types[2]}
3) {play_types[3]}
: """))
print(f"Jugada: {play_types[play]}")
return play
while True:
play1 = int(get_play("1"))
play2 = int(get_play("2"))
juego = (play1,play2)
print("")
if juego in [(2,1),(3,2),(1,3)]:
print("Gana jugador 1")
elif juego in [(1,2),(2,3),(3,1)]:
print("Gana jugador 2")
elif juego in [(1,1),(2,2),(3,3)]:
print("empate")
else:
print("pasó algo raro")
q = input("""
¿salir? [Y/N]""")
if q == "Y":
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment