Max1m3
-
26 oct. 2021 à 18:36
mamiemando
Messages postés33372Date d'inscriptionjeudi 12 mai 2005StatutModérateurDernière intervention22 novembre 2024
-
27 oct. 2021 à 15:13
Bonjour, j'ai un programme en python que j'aimerais convertir en html, ou css, ou javascript, php. Bref, j'aimerais savoir s'il y a un moyen simple d'avoir mon programme dans un fichier web. Merci !
Le programme :
#Programme du Pierre Feuille Ciseau
from time import sleep
from random import randint
won_ordi = 0
won_player = 0
manches = 1
signe_bon = False
type_bon = False
print("Bienvenue au jeu du Pierre Feuille Ciseau")
sleep(1)
print()
print("Le jeu se joue en 3 manches gagnantes. Vous devrez écrire P pour Pierre, F pour Feuille, et C pour Ciseau.")
sleep(1)
print()
print("Tous les signes choisis par l'ordinateur seront soit pris aléatoirement, soit pris en fonction de votre réponse à la manche précédente \nMais jamais en fonction de votre réponse actuelle (comme dans le vrai jeu).")
sleep(1)
print()
while type_bon == False :
game_type = input("Si vous préférez un jeu aléatoire, taper A, et pour une intelligence artificielle, tapez IA : ")
if game_type != "A" and game_type != "IA":
print("Veuillez entrer une valeur correcte !")
else:
type_bon = True
if game_type == "A":
while won_ordi != 3 and won_player != 3 :
print("Ordi :", won_ordi, "Player :", won_player)
signe_ordi = randint(1,3)
print()
print("Manche", manches)
while signe_bon == False:
signe_player = input("P, F ou C : ")
if signe_player != "P" and signe_player != "F" and signe_player != "C" :
print("Veuillez entrer une valeur correcte !")
else :
signe_bon = True
signe_bon = False
if signe_ordi == 1 and signe_player == "P":
print("Pierre")
sleep(1)
print("Egalité")
manches = manches + 1
elif signe_ordi == 1 and signe_player == "F":
print("Pierre")
sleep(1)
print("Bravo, tu as gagné !")
won_player = won_player + 1
manches = manches + 1
elif signe_ordi == 1 and signe_player == "C":
print("Pierre")
sleep(1)
print("L'ordinateur a gagné :-(")
won_ordi = won_ordi + 1
manches = manches + 1
if signe_ordi == 2 and signe_player == "F":
print("Feuille")
sleep(1)
print("Egalité")
manches = manches + 1
elif signe_ordi == 2 and signe_player == "C":
print("Feuille")
sleep(1)
print("Bravo, tu as gagné !")
won_player = won_player + 1
manches = manches + 1
elif signe_ordi == 2 and signe_player == "P":
print("Feuille")
sleep(1)
print("L'ordinateur a gagné :-(")
won_ordi = won_ordi + 1
manches = manches + 1
if signe_ordi == 3 and signe_player == "C":
print("Ciseau")
sleep(1)
print("Egalité")
manches = manches + 1
elif signe_ordi == 3 and signe_player == "P":
print("Ciseau")
sleep(1)
print("Bravo, tu as gagné !")
won_player = won_player + 1
manches = manches + 1
elif signe_ordi == 3 and signe_player == "F":
print("Ciseau")
sleep(1)
print("L'ordinateur a gagné la partie :-(")
won_ordi = won_ordi + 1
manches = manches + 1
if won_ordi > won_player :
print()
print("L'ordinateur a gagné la partie :-(")
sleep(1)
print("Tu avais", won_player, "points, contre", won_ordi, "points pour l'ordinateur.")
elif won_player > won_ordi :
print()
print("Bravo, tu as gagné la partie !!!")
sleep(1)
print("Tu avais", won_player, "points, contre", won_ordi, "points pour l'ordinateur.")
sleep(5)
quit()
elif game_type == "IA":
print("Ordi :", won_ordi, "Player :", won_player)
#Utilisation d'un système psychologique -> en disant qu'on n'utilise pas de puit, le joueur va avoir tendance à jouer la pierre, on prend la feuille
print("Attention, pas de puit !")
sleep(1)
#Manche 1
print()
print("Manche", manches)
while signe_bon == False:
signe_player = input("P, F ou C : ")
if signe_player != "P" and signe_player != "F" and signe_player != "C" :
print("Veuillez entrer une valeur correcte !")
else :
signe_bon = True
signe_bon = False
if signe_player == "F":
print("Feuille")
sleep(1)
print("Egalité")
manches = manches + 1
last_won_player = 0
last_lose_player = 0
elif signe_player == "C":
print("Feuille")
sleep(1)
print("Bravo, tu as gagné !")
won_player = won_player + 1
manches = manches + 1
last_lose_player = 0
last_won_player = "C"
elif signe_player == "P":
print("Feuille")
sleep(1)
print("L'ordinateur a gagné :-(")
won_ordi = won_ordi + 1
manches = manches + 1
last_won_player = 0
last_lose_player = "P"
while won_ordi != 3 and won_player != 3:
print("Ordi :", won_ordi, "Player :", won_player)
if last_won_player == "P":
signe_ordi = 2
elif last_won_player == "F":
signe_ordi = 3
elif last_won_player == "C":
signe_ordi = 1
elif last_lose_player == "P":
signe_ordi = 3
elif last_lose_player == "F":
signe_ordi = 1
elif last_lose_player == "C":
signe_ordi = 2
elif last_lose_player == 0 and last_won_player == 0:
signe_ordi = randint(1, 3)
print()
print("Manche", manches)
while signe_bon == False:
signe_player = input("P, F ou C : ")
if signe_player != "P" and signe_player != "F" and signe_player != "C" :
print("Veuillez entrer une valeur correcte !")
else :
signe_bon = True
signe_bon = False
if signe_ordi == 1 and signe_player == "P":
print("Pierre")
sleep(1)
print("Egalité")
manches = manches + 1
last_lose_player = 0
last_won_player = 0
elif signe_ordi == 1 and signe_player == "F":
print("Pierre")
sleep(1)
print("Bravo, tu as gagné !")
won_player = won_player + 1
manches = manches + 1
last_won_player = "F"
last_lose_player = 0
elif signe_ordi == 1 and signe_player == "C":
print("Pierre")
sleep(1)
print("L'ordinateur a gagné :-(")
won_ordi = won_ordi + 1
manches = manches + 1
last_lose_player = "C"
last_won_player = 0
if signe_ordi == 2 and signe_player == "F":
print("Feuille")
sleep(1)
print("Egalité")
manches = manches + 1
last_lose_player = 0
last_won_player = 0
elif signe_ordi == 2 and signe_player == "C":
print("Feuille")
sleep(1)
print("Bravo, tu as gagné !")
won_player = won_player + 1
manches = manches + 1
last_won_player = "C"
last_lose_player = 0
elif signe_ordi == 2 and signe_player == "P":
print("Feuille")
sleep(1)
print("L'ordinateur a gagné :-(")
won_ordi = won_ordi + 1
manches = manches + 1
last_lose_player = "P"
last_won_player = 0
if signe_ordi == 3 and signe_player == "C":
print("Ciseau")
sleep(1)
print("Egalité")
manches = manches + 1
last_lose_player = 0
last_won_player = 0
elif signe_ordi == 3 and signe_player == "P":
print("Ciseau")
sleep(1)
print("Bravo, tu as gagné !")
won_player = won_player + 1
manches = manches + 1
last_won_player = "P"
last_lose_player = 0
elif signe_ordi == 3 and signe_player == "F":
print("Ciseau")
sleep(1)
print("L'ordinateur a gagné :-(")
won_ordi = won_ordi + 1
manches = manches + 1
last_lose_player = "F"
last_won_player = 0
if won_ordi > won_player :
print("L'ordinateur a gagné la partie :-(")
sleep(1)
print("Tu avais", won_player, "points, contre", won_ordi, "points pour l'ordinateur.")
elif won_player > won_ordi :
print("Bravo, tu as gagné la partie !!!")
sleep(1)
print("Tu avais", won_player, "points, contre", won_ordi, "points pour l'ordinateur.")
sleep(5)
quit()