This commit is contained in:
ykyliane
2026-06-08 13:28:05 +02:00
parent deaeb6cc19
commit 50648604f9
+58 -25
View File
@@ -1,30 +1,63 @@
import random
score_p = 0
score_IA = 0
tentative = 0
manche = 0
max_manche = 10
print("BIENVENUE DANS 1,2,3 PIERRE FEUILLE CISEAUX 🎮")
print("le score est actuellement de :","Player👤 =",score_p,"et","IA 🤖 =",score_IA)
#choix du joueur
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":
print("IA a gagné !")
elif option_player == "feuille" and option_IA == "ciseaux":
print("IA a gagné !")
elif option_player == "ciseaux" and option_IA == "pierre":
print("IA a gagné !")
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 : Player👤:",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 : Player👤:",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 : Player👤:",score_p,"IA🤖:",score_IA)
#condition victoire player
elif option_player == "pierre" and option_IA == "ciseaux":
print("Vous avez Gagné !")
elif option_player == "feuille" and option_IA == "pierre":
print("Vous avez Gagné !")
elif option_player == "ciseaux" and option_IA == "feuille":
print("Vous avez Gagné !")
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 : Player👤:",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 : Player👤:",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 : Player👤:",score_p,"IA🤖:",score_IA)
#condition d'égalité
elif option_player == "pierre" and option_IA == "pierre":
print("égalité !")
elif option_player == "feuille" and option_IA == "feuille":
print("égalité !")
elif option_player == "ciseaux" and option_IA == "ciseaux":
print("égalité")
elif option_player == "pierre" and option_IA == "pierre" and tentative <= 5:
print("égalité !🤝")
print("le nouveau score est : Player👤:",score_p,"IA🤖:",score_IA)
elif option_player == "feuille" and option_IA == "feuille" and tentative <= 5:
print("égalité !🤝")
print("le nouveau score est : Player👤:",score_p,"IA🤖:",score_IA)
elif option_player == "ciseaux" and option_IA == "ciseaux" and tentative <= 5:
print("égalité🤝")
print("le nouveau score est : Player👤:",score_p,"IA🤖:",score_IA)
#exception
else:
print("ERROR !!")
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()