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.
47 lines
1.2 KiB
47 lines
1.2 KiB
2 years ago
|
from random import *
|
||
2 years ago
|
from lib.File import File_lst as File
|
||
2 years ago
|
|
||
2 years ago
|
class Carte:
|
||
|
def __init__(self, valeur, couleur):
|
||
|
self.valeur = valeur
|
||
|
self.couleur = couleur
|
||
|
|
||
|
def compare(self, other):
|
||
|
if self.valeur > other:
|
||
|
return 1
|
||
|
elif self.valeur < other:
|
||
|
return -1
|
||
|
else:
|
||
|
return 0
|
||
|
|
||
2 years ago
|
|
||
2 years ago
|
class Jeux:
|
||
2 years ago
|
def __init__(self, nbcartes):
|
||
|
self.paquet = File()
|
||
|
if nbcartes == 32:
|
||
|
pq = [1, 7, 8, 9, 10, 'Valet', 'Dame', 'Roi']
|
||
|
else:
|
||
|
pq = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'Valet', 'Dame', 'Roi']
|
||
|
|
||
|
for i in range(len(pq)):
|
||
|
rd = randint(0, len(pq)-1)
|
||
|
self.paquet.enfiler(pq[rd])
|
||
|
pq.pop(rd)
|
||
|
|
||
|
def distribue(self):
|
||
|
f1 = File()
|
||
|
f2 = File()
|
||
2 years ago
|
for val in range(self.paquet.taille()):
|
||
|
f1.enfiler(self.paquet[val])
|
||
|
f2.enfiler(self.paquet[val])
|
||
|
print(f1, f2)
|
||
2 years ago
|
|
||
|
class Joueur:
|
||
|
def __init__(self, paquet_j, nom):
|
||
|
self.paquet_j = paquet_j
|
||
|
self.nom = nom
|
||
|
|
||
|
def tire_carte(self):
|
||
|
self.derniere_carte = self.paquet_j.defiler()
|
||
2 years ago
|
return self.derniere_carte
|