-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPOKER2
98 lines (84 loc) · 2.41 KB
/
POKER2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
class Carta():
def __init__(self,palo,valor):
#self.__color=color
self.__palo = palo
self.__valor=valor
def get_Carta(self):
return self.__valor
def get_Palo(self):
return self.__palo
def __str__(self):
return f"Valor:{self.__valor} and Palo:{self.__palo}"
if __name__=="__main__":
carta1=Carta("T",4)
print(carta1)
__________________________Ventana2_____________________________
from POKER2 import Carta
class Baraja:
listnum=[x for x in range(1,14)]
listPal=["C","T","P","D"]
def __init__(self,baraja):
self.lista=baraja
_____________________________Codigo 2_______________________________
import random
class Poker:
def __init__(self, tipo, numero):
self.tipo = tipo
self.num = numero
def __str__(self):
return f"Tipo:{self.tipo} y Numero:{self.num}"
class Baraja:
def __init__(self):
self.tipo = ["C", "T", "P", "D"]
self.num = [x for x in range(1, 14)]
def crearBaraja(self):
baraja = []
baraja2 = []
for palo in self.tipo:
for num in self.num:
baraja2.append(palo)
baraja2.append(num)
baraja.append(baraja2)
baraja2 = []
return baraja
def repartirmano(self):
mano1=[]
for i in range(5):
car_rand=random.choice(baraja.crearBaraja())
mano1.append(car_rand)
#print(baraja.crearBaraja())
print(mano1)
return mano1
def escalera(self):
manonum = [4,5,6,9,8]
"""for i in baraja.repartirmano():
manonum.append(i[1])
manonum.sort()"""
m = 40000
confirmar = False
for i in manonum:
if m==40000:
pass
else:
if i==m+1:
esca+=1
m=i
if esca >=5
confirmar= True
return manonum, confirmar
if __name__=="__main__":
baraja = Baraja()
#print(baraja.crearBaraja())
mano1= baraja.repartirmano()
escalera,confirmar=baraja.escalera()
#print(mano1)
print(escalera)
print(confirmar)
"""class Maso(baraja):
def __init__(self, tipo, numero):
Baraja().__init__(tipo, numero)
self.tipo = tipo
self.num = numero
def Maso(self):
maso1 = []
for i in baraja:"""