You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
711 B
24 lines
711 B
5 days ago
|
from bataille.Carte import Carte
|
||
|
from random import shuffle
|
||
|
|
||
|
class Jeux:
|
||
|
def __init__(self):
|
||
|
"""Constructeur de la classe Jeux"""
|
||
|
couleurs = ["carreau", "coeur", "pique", "trefle"]
|
||
|
valeurs = list(range(2, 15)) # génère une liste de 2 à 14
|
||
|
self.paquet = [Carte(valeur, couleur) for valeur in valeurs for couleur in couleurs]
|
||
|
|
||
|
def distribue(self, File):
|
||
|
"""Distribution des cartes"""
|
||
|
f1 = File()
|
||
|
f2 = File()
|
||
|
shuffle(self.paquet)
|
||
|
for i, carte in enumerate(self.paquet):
|
||
|
if i % 2 == 0:
|
||
|
f1.enfiler(carte)
|
||
|
else:
|
||
|
f2.enfiler(carte)
|
||
|
return f1, f2
|
||
|
|
||
|
|