|
@ -24,10 +24,10 @@ class Jeux: |
|
|
nb = len(self.paquet) |
|
|
nb = len(self.paquet) |
|
|
if nb == 32 : |
|
|
if nb == 32 : |
|
|
nbcarte = nb |
|
|
nbcarte = nb |
|
|
elif nb == 54 : |
|
|
elif nb == 52 : |
|
|
nbcarte = nb |
|
|
nbcarte = nb |
|
|
else : |
|
|
else : |
|
|
raise ValueError("Saissisez 32 ou 54 cartes") |
|
|
raise ValueError("Saissisez 32 ou 52 cartes") |
|
|
|
|
|
|
|
|
for i in range(nbcarte): |
|
|
for i in range(nbcarte): |
|
|
carte = Carte() |
|
|
carte = Carte() |
|
@ -48,23 +48,29 @@ class Jeux: |
|
|
j2 = distribute(2) |
|
|
j2 = distribute(2) |
|
|
while not j1.estvide() or j2.estvide() : |
|
|
while not j1.estvide() or j2.estvide() : |
|
|
|
|
|
|
|
|
j1tete = j1.tete() |
|
|
#j1tete = j1.tete() |
|
|
j2tete = j2.tete() |
|
|
#j2tete = j2.tete() |
|
|
|
|
|
|
|
|
if j1tete.valeur() > j2tete.valeur() : |
|
|
while not Carte(j1.tete, j2.tete) == 0 : |
|
|
j1.enfiler(j1tete) |
|
|
|
|
|
j1.enfiler(j2tete) |
|
|
|
|
|
|
|
|
|
|
|
elif j1tete.valeur() < j2tete.valeur() : |
|
|
carte_envers = #id carte à l'envers dans la base de donnée |
|
|
j2.enfiler(j1tete) |
|
|
j1.emfiler(carte_envers)#add carte à l'envers à j1 |
|
|
j2.enfiler(j2tete) |
|
|
j2.emfiler(carte_envers)#add carte à l'envers à j2 |
|
|
|
|
|
j1.emfiler(j1.defiler()) |
|
|
|
|
|
j2.emfiler(j2.defiler()) |
|
|
|
|
|
|
|
|
elif j1tete.valeur() == j2tete.valeur() : |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if Carte(j1.tete, j2.tete) == 1 : |
|
|
|
|
|
j1.enfiler(j1.defiler()) |
|
|
|
|
|
j1.enfiler(j2.defiler()) |
|
|
|
|
|
|
|
|
|
|
|
elif Carte(j1.tete, j2.tete) == -1 : |
|
|
|
|
|
j2.enfiler(j1.defiler()) |
|
|
|
|
|
j2.enfiler(j2.defiler()) |
|
|
|
|
|
|
|
|
j1.depiler() |
|
|
j1.defiler() |
|
|
j2.depiler() |
|
|
j2.defiler() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if j1.estvide() == True : |
|
|
if j1.estvide() == True : |
|
|