Created
April 11, 2020 10:13
-
-
Save Sephi-Chan/23563f3eabfac1857d21bd7660a4c4e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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