|
@ -2,7 +2,6 @@ from bataille import * |
|
|
from lib.Pile import Pile_lst |
|
|
from lib.Pile import Pile_lst |
|
|
|
|
|
|
|
|
def bataille(): |
|
|
def bataille(): |
|
|
tour = 1 |
|
|
|
|
|
jeux = Jeux() |
|
|
jeux = Jeux() |
|
|
carte_j1, carte_j2 = jeux.depiler() |
|
|
carte_j1, carte_j2 = jeux.depiler() |
|
|
nom = str(input("Entrez votre nom")) |
|
|
nom = str(input("Entrez votre nom")) |
|
@ -11,19 +10,23 @@ def bataille(): |
|
|
p_j1 = Pile_lst() |
|
|
p_j1 = Pile_lst() |
|
|
p_j2 = Pile_lst() |
|
|
p_j2 = Pile_lst() |
|
|
while not j1.paquet_j.est_vide() and not j2.paquet_j.est_vide(): |
|
|
while not j1.paquet_j.est_vide() and not j2.paquet_j.est_vide(): |
|
|
valeur_carte_j1 = j1.tire_carte() |
|
|
p_j1.empile(j1.tire_carte()) |
|
|
valeur_carte_j2 = j2.tire_carte() |
|
|
p_j2.empile(j2.tire_carte()) |
|
|
p_j1.empile(valeur_carte_j1) |
|
|
|
|
|
p_j2.empile(valeur_carte_j2) |
|
|
|
|
|
gagne = p_j1.sommet().compare(p_j2.sommet()) |
|
|
gagne = p_j1.sommet().compare(p_j2.sommet()) |
|
|
|
|
|
|
|
|
if gagne == 1: |
|
|
if gagne == 1: |
|
|
j1.paquet_j.append(p_j2.depiler()) |
|
|
j1.paquet_j.append(p_j2.depiler()) |
|
|
|
|
|
|
|
|
elif gagne == 2: |
|
|
elif gagne == 2: |
|
|
j2.paquet_j.append(p_j1.depiler()) |
|
|
j2.paquet_j.append(p_j1.depiler()) |
|
|
|
|
|
|
|
|
else: |
|
|
else: |
|
|
for loop in range(2): |
|
|
for loop in range(2): |
|
|
valeur_carte_j1 = j1.tire_carte() |
|
|
p_j1.empile(j1.tire_carte()) |
|
|
valeur_carte_j2 = j2.tire_carte() |
|
|
p_j2.empile(j2.tire_carte()) |
|
|
p_j1.empile(valeur_carte_j1) |
|
|
|
|
|
p_j2.empile(valeur_carte_j2) |
|
|
if j1.paquet_j.est_vide(): |
|
|
|
|
|
print("Le perdant est le joueur 1") |
|
|
|
|
|
else: |
|
|
|
|
|
print("Le perdant est le joueur 2") |
|
|
|
|
|
|
|
|