-
Notifications
You must be signed in to change notification settings - Fork 1
/
poker2.py
88 lines (64 loc) · 2.06 KB
/
poker2.py
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
import random
def printCards(text, hand):
replacing = ['T', 'J', 'Q', 'K', 'A']
numbers = [10, 11, 12, 13, 14]
replaced = []
for card in hand.cards:
if card.number in numbers:
replaced.append(str(replacing[numbers.index(card.number)]) + card.suit)
else:
replaced.append(str(card.number) + card.suit)
print(text, " ".join(replaced))
"""
player = Player(10000, 0, None)
pc = Player(10000, 0, None)
table = Table(0, None)
def do():
dealer = Deck()
player.giveCards(dealer.draw(2))
pc.giveCards(dealer.draw(2))
table.flop(dealer.draw(5))#table.flop([Card(i, '♥') for i in range(2, 7)])
def did():
replacing = ['T', 'J', 'Q', 'K', 'A']
numbers = [10, 11, 12, 13, 14]
a,b,c = PC 2♦ 9♦
TABLE 6♣ 7♠ Q♣ 7♣ A♦
ME 4♦ 5♥.split('\n')
a = a.replace("PC ", '')
b = b.replace("TABLE ", '')
c = c.replace("ME ", '')
def man(c):
c = c.split(' ')
new = []
for each in c:
if each[0] in replacing:
index = replacing.index(each[0])
new.append([each[0].replace(replacing[index], str(numbers[index])), each[1]])
else:
new.append([each[0], each[1]])
new = [Card(int(x[0]), x[1]) for x in new]
return new
man(a)
man(b)
table.flop(man(b))
pc.giveCards(man(a))
player.giveCards(man(c))
while True:
do()
printCards("PC", pc)
printCards("TABLE", table)
printCards("ME", player)
pcScore, playerScore = checkPoints(pc, table), checkPoints(player, table)
print("PC GOTS:", pcScore)
print("I GOT:", playerScore)
values = ["POKER", "FULL", "COLOR", "STRAIGHT", "TRIPLE", "TWOPAIRS", "ONEPAIR", "HIGHCARD"]
pcIndex = values.index(pcScore)
playerIndex = values.index(playerScore)
if playerIndex == pcIndex:
playerIndex, pcIndex = checkHighestCard(player, pc)
if playerIndex < pcIndex:
print("PLAYER WINS")
else:
print("PC WINS!")
input("New hand >")
"""