Skip to content

Instantly share code, notes, and snippets.

@Sephi-Chan
Created April 11, 2020 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sephi-Chan/23563f3eabfac1857d21bd7660a4c4e3 to your computer and use it in GitHub Desktop.
Save Sephi-Chan/23563f3eabfac1857d21bd7660a4c4e3 to your computer and use it in GitHub Desktop.
import random
PIERRE = 0
FEUILLE = 1
CISEAUX = 2
def shifumi(action_ordi, action_joueur):
if action_ordi == PIERRE and action_joueur == CISEAUX: return True
elif action_ordi == FEUILLE and action_joueur == PIERRE: return True
elif action_ordi == CISEAUX and action_joueur == FEUILLE: return True
if action_ordi == PIERRE and action_joueur == FEUILLE: return False
elif action_ordi == FEUILLE and action_joueur == CISEAUX: return False
elif action_ordi == CISEAUX and action_joueur == PIERRE: return False
return None
def nom(n):
if n == 0: return "Pierre"
elif n == 1: return "Feuille"
elif n == 2: return "Ciseaux"
random.seed(int(input()))
score = 0
for i in range(0, 5):
ordi = random.randint(0, 2)
joueur = int(input())
resultat = shifumi(ordi, joueur)
if resultat == True:
score -= 1
print(nom(ordi) + " bat " + nom(joueur) + " : " + str(score))
elif resultat == False:
score += 1
print(nom(ordi) + " est battu par " + nom(joueur) + " : " + str(score))
else:
print(nom(ordi) + " annule " + nom(joueur) + " : " + str(score))
if score < 0: print("Perdu")
elif score == 0: print("Nul")
else: print("Gagné")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment