Browse Source

ca marche

master
BARRAUX Arthur 2 years ago
parent
commit
aa5d9679cf
  1. 25
      main.py

25
main.py

@ -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
print(self.j1, self.j2)
@ -66,16 +66,21 @@ class Jeux:
print(self.j1, self.j2)
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 :
# envers
buffer_draw[0].enfiler(j1_active_carte) # carte du dessus
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 a l'envers
self.bataille(buffer_draw)
try:
# envers
buffer_draw[0].enfiler(self.j1.defiler()) # carte du dessus
buffer_draw[0].enfiler(self.j1.defiler()) # carte a l'envers
buffer_draw[1].enfiler(self.j2.defiler()) # carte du dessus
buffer_draw[1].enfiler(self.j2.defiler()) # carte a l'envers
# print('next_buff' ,buffer_draw[0], buffer_draw[1])
self.bataille(buffer_draw)
except IndexError:
pass
elif j1_active_carte.compare(j2_active_carte) == 1 :
while not buffer_draw[0].est_vide():

Loading…
Cancel
Save