-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstripMe.py
69 lines (56 loc) · 1.45 KB
/
stripMe.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
from Assets.util import *
def strip_me():
players = prepPlayers()
discardPlie = makeStack()
def play(currentPlayer):
counter = 0
if currentPlayer == 0:
hand = players[0]
elif currentPlayer == 1:
hand = players[1]
played = playCard(currentPlayer, hand, discardPlie)
print('\n'+str(played[0]))
try:
#IF card played is a "Pretty"
if isPayCard(top(discardPlie)):
#pay = number of cards to pay with
pay = getCardRate(top(discardPlie))
#Pay with 'pay' number of cards
for _ in range(pay):
if currentPlayer == 1:
play(0)
elif currentPlayer == 0:
play(1)
#if card played is a pretty
if isPayCard(top(discardPlie)):
#stop paying
break
else:
#make a note of how much cards already paid
counter += 1
#if number of cards paid matches the amount to be paid
if counter == pay:
#player0 takes all the cards in the discardPile
takePayment(hand, discardPlie)
print("\n"+"The full payment was made. Player {} claimed the discard pile".format(currentPlayer))
except:
pass
print(showGreeting)
while True:
option = input("play(Enter); quit(q,then enter) ")
if option is 'q':
print("You quit the game before it ended, so there's no result. Bye!")
break
try:
play(1)
except:
print("Player 0 WON!")
break
try:
play(0)
except:
print("Player 1 WON!")
break
print('\n')
if __name__ == '__main__':
strip_me()