-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblackjack2.py
60 lines (53 loc) · 1.31 KB
/
blackjack2.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
## blackjack, war, poker
import random
import sys
from Card import *
from Hand import *
from Shoe import *
print "Welcome to the best gaming experience of your natural born life..."
## games
def war():
print "war"
def poker():
print "poker"
def blackjack():
deck = Shoe()
hand = deck.deal(2)
print "you were dealt", hand[0], "and", hand[1]
hitorquit = raw_input("hit? (y/n) ")
k = 2
while hitorquit is "y":
if hitorquit is "y":
hand = hand + deck.deal(1)
print "you now have a", hand[k]
hitorquit = raw_input("hit? (y/n) ")
k += 1
if hitorquit is "n":
f = random.randint(18,21)
total = input("enter your total!" )
if total < 21 and total > f:
print "YOU WIN!!"
x = 1
elif total < f:
print "YOU LOSE!!"
elif total == f:
print "A TIE!! DEALER WINS.. WHO EVER THAT IS!"
elif total > 21:
print "FOLDED!!"
print "the computer was dealt", f
entrance = raw_input("play again? (y/n) ")
while entrance is "y":
if entrance is "y":
return play(enter)
elif entrance is "n":
return sys.exit(0)
## introduction
def play(enter):
if enter is "a":
return blackjack()
elif enter is "b":
return war()
elif enter is "c":
return poker()
enter = raw_input("would you like to play \n (a) blackjack \n (b) war \n (c) poker \nenter(a/b/c): ")
play(enter)