Files
ZONE-01-STUDY/pierre_feuille_ciseau.py
2026-06-08 15:00:14 +02:00

67 lines
3.1 KiB
Python

import random
score_p = 0
score_IA = 0
tentative = 0
manche = 0
max_manche = 10
ID = input("veuillez saisir votre nom avant de commencer !")
print("BIENVENUE,DANS 1,2,3 PIERRE FEUILLE CISEAUX 🎮",ID)
print("le score est actuellement de :",ID,"👤 =",score_p,"et","IA 🤖 =",score_IA)
#choix du joueur
while tentative <= 5 and manche < max_manche and score_IA >= 0 and score_p >= 0:
option_player=input("choisissez :" "pierre, feuille , ciseaux : ")
#choix du bot
option_IA = random.choice(["pierre","feuille" , "ciseaux"])
print(option_IA)
#creation des regle de victoire IA
if option_player == "pierre" and option_IA == "feuille" and tentative <= 5:
print("IA a gagné !😊")
score_IA = score_IA+1
print("le nouveau score est :",ID,"👤:",score_p,"IA🤖:",score_IA)
elif option_player == "feuille" and option_IA == "ciseaux" and tentative <= 5:
score_IA = score_IA+1
print("le nouveau score est :",ID,"👤:",score_p,"IA🤖:",score_IA)
print("IA a gagné !😊")
elif option_player == "ciseaux" and option_IA == "pierre" and tentative <= 5:
print("IA a gagné !😊")
score_IA = score_IA+1
print("le nouveau score est :",ID,"👤:",score_p,"IA🤖:",score_IA)
#condition victoire player
elif option_player == "pierre" and option_IA == "ciseaux" and tentative <= 5:
print("Vous avez Gagné !🎉")
score_p = score_p+1
print("le nouveau score est :",ID,"👤:",score_p,"IA🤖:",score_IA)
elif option_player == "feuille" and option_IA == "pierre" and tentative <= 5:
print("Vous avez Gagné !🎉")
score_p = score_p+1
print("le nouveau score est :",ID,"👤:",score_p,"IA🤖:",score_IA)
elif option_player == "ciseaux" and option_IA == "feuille" and tentative <= 5:
print("Vous avez Gagné 🎉")
score_p = score_p+1
print("le nouveau score est :",ID,"👤:",score_p,"IA🤖:",score_IA)
#condition d'égalité
elif option_player == "pierre" and option_IA == "pierre" and tentative <= 5:
print("égalité !🤝")
print("le nouveau score est :",ID,"👤:",score_p,"IA🤖:",score_IA)
elif option_player == "feuille" and option_IA == "feuille" and tentative <= 5:
print("égalité !🤝")
print("le nouveau score est :",ID,"👤:",score_p,"IA🤖:",score_IA)
elif option_player == "ciseaux" and option_IA == "ciseaux" and tentative <= 5:
print("égalité🤝")
print("le nouveau score est :",ID,"👤:",score_p,"IA🤖:",score_IA)
if option_player not in ["pierre","feuille","ciseaux"] :
print("Choix Invalide❌")
#exception
continuer = str(input("Voulez vous continuer ? :"))
if continuer == "oui" and manche < max_manche:
manche = manche+1
answer_IA1 = random.choice (["Fantastique !😊","Merveilleux !🎉", "Super !😁",])
print(answer_IA1)
elif continuer == "non" :
answer_IA2 = random.choice (["D'accord à Bientot !😊","C'était cool !😃", "A la prochaine !😁"])
print(answer_IA2)
exit()
else:
print("ERROR !!❌")
exit()