|
|
@ -1,11 +1,16 @@ |
|
|
|
import tkinter as tk |
|
|
|
import time |
|
|
|
from random import shuffle |
|
|
|
from File import File_chaine as File |
|
|
|
|
|
|
|
#______________________________________ |
|
|
|
class Carte: |
|
|
|
def __init__(self, valeur, couleur): |
|
|
|
self.valeur = valeur |
|
|
|
self.couleur = couleur |
|
|
|
|
|
|
|
#________ |
|
|
|
|
|
|
|
def compare(self, other): |
|
|
|
if self.valeur > other.valeur: |
|
|
|
return 1 |
|
|
@ -13,7 +18,41 @@ class Carte: |
|
|
|
return -1 |
|
|
|
return 0 |
|
|
|
|
|
|
|
#__________ |
|
|
|
class Jeux: |
|
|
|
def __init__(self): |
|
|
|
self.paquet = [] |
|
|
|
couleurs = ["Coeurs", "Carreaux", "Trèfles", "Piques"] |
|
|
|
if nb_cartes == 32: |
|
|
|
valeurs = ["1", "7", "8", "9", "10", "Valet", "Dame", "Roi", "As"] |
|
|
|
elif nb_cartes == 52: |
|
|
|
valeurs = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Valet", "Dame", "Roi", "As"] |
|
|
|
else: |
|
|
|
print("Nombre de cartes invalide") |
|
|
|
time.sleep(0.5) |
|
|
|
raise ValueError |
|
|
|
|
|
|
|
|
|
|
|
for couleur in couleurs: |
|
|
|
for valeur in valeurs: |
|
|
|
paquet = [Carte(valeur, couleur)] |
|
|
|
shuffle(paquet) |
|
|
|
|
|
|
|
for carte in paquet: |
|
|
|
print(carte) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#________ |
|
|
|
|
|
|
|
def distribute(self): |
|
|
|
f1 = File_lst() |
|
|
|
f2 = File_lst() |
|
|
|
f1 = len(self.paquet)//2 |
|
|
|
f2 = reversed.len(self.paquet)//2 |
|
|
|
|
|
|
|
return f1, f2 |
|
|
|
|
|
|
|
class jeux(paquet, ): |
|
|
|
def __init__(self, nb_cartes, coleur): |
|
|
|
pass |
|
|
|
#______________________________________ |
|
|
|
nb_cartes = 32 #52 |
|
|
|
Jeux() |
|
|
|