|
|
@ -31,12 +31,15 @@ class Carte: |
|
|
|
return tmp + " de " + self.couleur |
|
|
|
#__________ |
|
|
|
class Jeux: |
|
|
|
def __init__(self): |
|
|
|
"""classe d'un jeu""" |
|
|
|
def __init__(self, nb_cartes): |
|
|
|
"""initialisation du jeu""" |
|
|
|
self.paquet = [] |
|
|
|
self.nb_cartes = nb_cartes |
|
|
|
couleurs = ["Coeur", "Carreaux", "Trèfle", "Pique"] |
|
|
|
if nb_cartes == 32: |
|
|
|
if self.nb_cartes == 32: |
|
|
|
valeurs = [1, 7, 8, 9, 10, 11, 12, 13] |
|
|
|
elif nb_cartes == 52: |
|
|
|
elif self.nb_cartes == 52: |
|
|
|
valeurs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] |
|
|
|
else: |
|
|
|
raise ValueError("Nombre de cartes invalide") |
|
|
@ -48,16 +51,22 @@ class Jeux: |
|
|
|
|
|
|
|
|
|
|
|
def distribue(self): |
|
|
|
f1 = File_lst() |
|
|
|
f2 = File_lst() |
|
|
|
f1 = len(self.paquet)//2 |
|
|
|
f2 = reversed.len(self.paquet)//2 |
|
|
|
|
|
|
|
"""distribution des cartes""" |
|
|
|
f1 = File() |
|
|
|
f2 = File() |
|
|
|
if self.nb_cartes == 52: |
|
|
|
for i in range(26): |
|
|
|
f1.enfiler(self.paquet.pop()) |
|
|
|
f2.enfiler(self.paquet.pop()) |
|
|
|
else: |
|
|
|
for i in range(16): |
|
|
|
f1.enfiler(self.paquet.pop()) |
|
|
|
f2.enfiler(self.paquet.pop()) |
|
|
|
return f1, f2 |
|
|
|
|
|
|
|
#______________________________________ |
|
|
|
nb_cartes = 42 #52 |
|
|
|
Jeux() |
|
|
|
partie = Jeux(32) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|