Skip to content

Commit a63135b

Browse files
committed
Merge branch 'geekcomputers:master' into master
2 parents 658808e + 85fd9cc commit a63135b

26 files changed

+1597
-284
lines changed

BlackJack_game/blackjack_rr.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
import random
22

3-
suits = ('Hearts', 'Diamonds', 'Spades', 'Clubs')
3+
class Colour:
4+
BLACK = '\033[30m'
5+
RED = '\033[91m'
6+
GREEN = '\033[32m'
7+
END = '\033[0m'
8+
9+
suits = (Colour.RED + 'Hearts' + Colour.END, Colour.RED + 'Diamonds' + Colour.END, Colour.BLACK + 'Spades' + Colour.END, Colour.BLACK + 'Clubs' + Colour.END)
410
ranks = ('Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Jack', 'Queen', 'King', 'Ace')
511
values = {'Two': 2, 'Three': 3, 'Four': 4, 'Five': 5, 'Six': 6, 'Seven': 7, 'Eight': 8,
612
'Nine': 9, 'Ten': 10, 'Jack': 10, 'Queen': 10, 'King': 10, 'Ace': 11}
713

814
playing = True
915

10-
1116
class Card:
1217

1318
def __init__(self, suit, rank):
@@ -157,7 +162,7 @@ def push(player, dealer):
157162
print(
158163
"\t Welcome to the game Casino - BLACK JACK ! ")
159164
print("\t **********************************************************")
160-
print("\t ***************")
165+
print(Colour.BLACK + "\t ***************")
161166
print("\t * A *")
162167
print("\t * *")
163168
print("\t * * *")
@@ -167,7 +172,7 @@ def push(player, dealer):
167172
print("\t * * *")
168173
print("\t * *")
169174
print("\t * *")
170-
print("\t ***************")
175+
print("\t ***************" + Colour.END)
171176

172177
print('\nRULES: Get as close to 21 as you can but if you get more than 21 you will lose!\n Aces count as 1 or 11.')
173178

@@ -224,8 +229,7 @@ def push(player, dealer):
224229
continue
225230
else:
226231
print(
227-
"Thanks for playing!\n \t$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n \t Congratulations! You won {} coins!\n\t$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n ".format(
228-
player_chips.total))
232+
"Thanks for playing!\n" + Colour.GREEN + "\t$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n \t Congratulations! You won " + str(player_chips.total) + " coins!\n\t$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n " + Colour.END)
229233
break
230234
else:
231235
print(

Conversation.py

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# imports modules
2+
import sys
3+
import time
4+
from getpass import getuser
5+
6+
# user puts in their name
7+
name = getuser()
8+
name_check = input("Is your name " + name + "? → ")
9+
if name_check.lower().startswith("y"):
10+
print("Okay.")
11+
time.sleep(1)
12+
13+
if name_check.lower().startswith("n"):
14+
name = input("Then what is it? → ")
15+
16+
# Python lists their name
17+
userList = name
18+
19+
# Python & user dialoge
20+
print("Hello", name + ", my name is Python." )
21+
time.sleep(0.8)
22+
print("The first letter of your name is", userList[0] + ".")
23+
time.sleep(0.8)
24+
print("Nice to meet you. :)")
25+
time.sleep(0.8)
26+
response = input("Would you say it's nice to meet me? → ")
27+
28+
# other dialoge
29+
if response.lower().startswith("y"):
30+
print("Nice :)")
31+
sys.exit()
32+
33+
elif response.lower().startswith("n"):
34+
response2 = input("Is it because I am a robot? → ")
35+
36+
else:
37+
print("You may have made an input error. Please restart and try again.")
38+
sys.exit()
39+
if response2.lower().startswith("y"):
40+
print("Aw :(")
41+
42+
elif response2.lower().startswith("n"):
43+
response3 = input("Then why? → ")
44+
time.sleep(1)
45+
print("Oh.")
46+
47+
else:
48+
print("You may have made an input error. Please restart and try again.")
49+
sys.exit()
50+
51+
52+
53+

0 commit comments

Comments
 (0)