|
@ -58,7 +58,7 @@ class Jeux: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.j1.est_vide() == True : |
|
|
if self.j1.est_vide(): |
|
|
# self.j1 a perdu donc self.j2 gagne toutes les cartes |
|
|
# self.j1 a perdu donc self.j2 gagne toutes les cartes |
|
|
|
|
|
|
|
|
print(self.j1, self.j2) |
|
|
print(self.j1, self.j2) |
|
@ -66,16 +66,21 @@ class Jeux: |
|
|
print(self.j1, self.j2) |
|
|
print(self.j1, self.j2) |
|
|
|
|
|
|
|
|
def bataille(self, buffer_draw=[File_chaine(), File_chaine()]): |
|
|
def bataille(self, buffer_draw=[File_chaine(), File_chaine()]): |
|
|
j1_active_carte, j2_active_carte = self.j1.defiler(), self.j2.defiler() |
|
|
# print('buffer', buffer_draw[0], buffer_draw[1], sep='\n') |
|
|
|
|
|
j1_active_carte, j2_active_carte = self.j1.tete(), self.j2.tete() |
|
|
if j1_active_carte.compare(j2_active_carte) == 0 : |
|
|
if j1_active_carte.compare(j2_active_carte) == 0 : |
|
|
|
|
|
try: |
|
|
|
|
|
|
|
|
# envers |
|
|
# envers |
|
|
buffer_draw[0].enfiler(j1_active_carte) # carte du dessus |
|
|
buffer_draw[0].enfiler(self.j1.defiler()) # carte du dessus |
|
|
buffer_draw[0].enfiler(self.j1.defiler()) # carte a l'envers |
|
|
buffer_draw[0].enfiler(self.j1.defiler()) # carte a l'envers |
|
|
|
|
|
|
|
|
buffer_draw[1].enfiler(j2_active_carte) # carte du dessus |
|
|
buffer_draw[1].enfiler(self.j2.defiler()) # carte du dessus |
|
|
buffer_draw[1].enfiler(self.j2.defiler()) # carte a l'envers |
|
|
buffer_draw[1].enfiler(self.j2.defiler()) # carte a l'envers |
|
|
|
|
|
# print('next_buff' ,buffer_draw[0], buffer_draw[1]) |
|
|
self.bataille(buffer_draw) |
|
|
self.bataille(buffer_draw) |
|
|
|
|
|
except IndexError: |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
elif j1_active_carte.compare(j2_active_carte) == 1 : |
|
|
elif j1_active_carte.compare(j2_active_carte) == 1 : |
|
|
while not buffer_draw[0].est_vide(): |
|
|
while not buffer_draw[0].est_vide(): |
|
|