Skip to content

Commit db23cf5

Browse files
authored
Initial Commit
1 parent d21fbef commit db23cf5

File tree

4 files changed

+358
-0
lines changed

4 files changed

+358
-0
lines changed

01 - Games/Hangman/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Hangman
2+
![Image](https://github.com/user-attachments/assets/9fd627af-64fc-4189-a9b2-c6339ffa4269)
3+
4+
5+
## Concepts:
6+
- How to break a Complex Problem down into a Flow Chart
7+
- How to Check the User's Answer
8+
- Improving the User Experience
9+
- How to Add ASCII Art and Improve the UI

01 - Games/Hangman/hangman_art.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
stages = [
2+
'''
3+
+---+
4+
| |
5+
O |
6+
/|\\ |
7+
/ \\ |
8+
|
9+
=========
10+
''',
11+
'''
12+
+---+
13+
| |
14+
O |
15+
/|\\ |
16+
/ |
17+
|
18+
=========
19+
''',
20+
'''
21+
+---+
22+
| |
23+
O |
24+
/|\\ |
25+
|
26+
|
27+
=========
28+
''',
29+
'''
30+
+---+
31+
| |
32+
O |
33+
/| |
34+
|
35+
|
36+
=========
37+
''',
38+
'''
39+
+---+
40+
| |
41+
O |
42+
| |
43+
|
44+
|
45+
=========
46+
''',
47+
'''
48+
+---+
49+
| |
50+
O |
51+
|
52+
|
53+
|
54+
=========
55+
''',
56+
'''
57+
+---+
58+
| |
59+
|
60+
|
61+
|
62+
|
63+
=========
64+
'''
65+
]
66+
logo2 = '''
67+
█▀▀░█▀█░█▀█░█▀▄░ ░█░█░█░█▀█░█▀█░█▄▀░█
68+
█▄█░█▄█░█▄█░█▄▀░ ░▀▄▀▄▀░█▄█░█▀▄░█░█░▄
69+
'''
70+
71+
logo3 = '''
72+
█░█░█░█▀▀░█░░░█▀▀░█▀█░█▀▄▀█░█▀▀░ ░▀█▀░█▀█░▀
73+
▀▄▀▄▀░██▄░█▄▄░█▄▄░█▄█░█░▀░█░██▄░ ░░█░░█▄█░▄
74+
75+
██╗░░██╗░█████╗░███╗░░██╗░██████╗░███╗░░░███╗░█████╗░███╗░░██╗
76+
██║░░██║██╔══██╗████╗░██║██╔════╝░████╗░████║██╔══██╗████╗░██║
77+
███████║███████║██╔██╗██║██║░░██╗░██╔████╔██║███████║██╔██╗██║
78+
██╔══██║██╔══██║██║╚████║██║░░╚██╗██║╚██╔╝██║██╔══██║██║╚████║
79+
██║░░██║██║░░██║██║░╚███║╚██████╔╝██║░╚═╝░██║██║░░██║██║░╚███║
80+
╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░╚══╝░╚═════╝░╚═╝░░░░░╚═╝╚═╝░░╚═╝╚═╝░░╚══╝'''
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
word_list = [
2+
'abruptly',
3+
'absurd',
4+
'abyss',
5+
'affix',
6+
'askew',
7+
'avenue',
8+
'awkward',
9+
'axiom',
10+
'azure',
11+
'bagpipes',
12+
'bandwagon',
13+
'banjo',
14+
'bayou',
15+
'beekeeper',
16+
'bikini',
17+
'blitz',
18+
'blizzard',
19+
'boggle',
20+
'bookworm',
21+
'boxcar',
22+
'boxful',
23+
'buckaroo',
24+
'buffalo',
25+
'buffoon',
26+
'buxom',
27+
'buzzard',
28+
'buzzing',
29+
'buzzwords',
30+
'caliph',
31+
'cobweb',
32+
'cockiness',
33+
'croquet',
34+
'crypt',
35+
'curacao',
36+
'cycle',
37+
'daiquiri',
38+
'dirndl',
39+
'disavow',
40+
'dizzying',
41+
'duplex',
42+
'dwarves',
43+
'embezzle',
44+
'equip',
45+
'espionage',
46+
'euouae',
47+
'exodus',
48+
'faking',
49+
'fishhook',
50+
'fixable',
51+
'fjord',
52+
'flapjack',
53+
'flopping',
54+
'fluffiness',
55+
'flyby',
56+
'foxglove',
57+
'frazzled',
58+
'frizzled',
59+
'fuchsia',
60+
'funny',
61+
'gabby',
62+
'galaxy',
63+
'galvanize',
64+
'gazebo',
65+
'giaour',
66+
'gizmo',
67+
'glowworm',
68+
'glyph',
69+
'gnarly',
70+
'gnostic',
71+
'gossip',
72+
'grogginess',
73+
'haiku',
74+
'haphazard',
75+
'hyphen',
76+
'iatrogenic',
77+
'icebox',
78+
'injury',
79+
'ivory',
80+
'ivy',
81+
'jackpot',
82+
'jaundice',
83+
'jawbreaker',
84+
'jaywalk',
85+
'jazziest',
86+
'jazzy',
87+
'jelly',
88+
'jigsaw',
89+
'jinx',
90+
'jiujitsu',
91+
'jockey',
92+
'jogging',
93+
'joking',
94+
'jovial',
95+
'joyful',
96+
'juicy',
97+
'jukebox',
98+
'jumbo',
99+
'kayak',
100+
'kazoo',
101+
'keyhole',
102+
'khaki',
103+
'kilobyte',
104+
'kiosk',
105+
'kitsch',
106+
'kiwifruit',
107+
'klutz',
108+
'knapsack',
109+
'larynx',
110+
'lengths',
111+
'lucky',
112+
'luxury',
113+
'lymph',
114+
'marquis',
115+
'matrix',
116+
'megahertz',
117+
'microwave',
118+
'mnemonic',
119+
'mystify',
120+
'naphtha',
121+
'nightclub',
122+
'nowadays',
123+
'numbskull',
124+
'nymph',
125+
'onyx',
126+
'ovary',
127+
'oxidize',
128+
'oxygen',
129+
'pajama',
130+
'peekaboo',
131+
'phlegm',
132+
'pixel',
133+
'pizazz',
134+
'pneumonia',
135+
'polka',
136+
'pshaw',
137+
'psyche',
138+
'puppy',
139+
'puzzling',
140+
'quartz',
141+
'queue',
142+
'quips',
143+
'quixotic',
144+
'quiz',
145+
'quizzes',
146+
'quorum',
147+
'razzmatazz',
148+
'rhubarb',
149+
'rhythm',
150+
'rickshaw',
151+
'schnapps',
152+
'scratch',
153+
'shiv',
154+
'snazzy',
155+
'sphinx',
156+
'spritz',
157+
'squawk',
158+
'staff',
159+
'strength',
160+
'strengths',
161+
'stretch',
162+
'stronghold',
163+
'stymied',
164+
'subway',
165+
'swivel',
166+
'syndrome',
167+
'thriftless',
168+
'thumbscrew',
169+
'topaz',
170+
'transcript',
171+
'transgress',
172+
'transplant',
173+
'triphthong',
174+
'twelfth',
175+
'twelfths',
176+
'unknown',
177+
'unworthy',
178+
'unzip',
179+
'uptown',
180+
'vaporize',
181+
'vixen',
182+
'vodka',
183+
'voodoo',
184+
'vortex',
185+
'voyeurism',
186+
'walkway',
187+
'waltz',
188+
'wave',
189+
'wavy',
190+
'waxy',
191+
'wellspring',
192+
'wheezy',
193+
'whiskey',
194+
'whizzing',
195+
'whomever',
196+
'wimpy',
197+
'witchcraft',
198+
'wizard',
199+
'woozy',
200+
'wristwatch',
201+
'wyvern',
202+
'xylophone',
203+
'yachtsman',
204+
'yippee',
205+
'yoked',
206+
'youthful',
207+
'yummy',
208+
'zephyr',
209+
'zigzag',
210+
'zigzagging',
211+
'zilch',
212+
'zipper',
213+
'zodiac',
214+
'zombie',
215+
]

01 - Games/Hangman/main.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
from hangman_art import stages, logo2, logo3
2+
from hangman_words import word_list
3+
import random
4+
5+
# Game Intro and Setup
6+
random_word = random.choice(word_list)
7+
lives = 6
8+
print(logo3+"\n")
9+
placeholder = ""
10+
for position in range(len(random_word)):
11+
placeholder += "_"
12+
13+
print(f"Guess this word: {placeholder}\n")
14+
15+
game_over = False
16+
correct_letters = []
17+
18+
while not game_over:
19+
print(f"********************{lives}/6 LIVES LEFT********************")
20+
guess = input("Choose a letter:\n").lower()
21+
22+
#Multiple Guess Confirmation
23+
if guess in correct_letters:
24+
print(f"\n~~~You've already guessed {guess} correctly!!~~~")
25+
26+
# Display Revealed or Hidden Characters
27+
display = ""
28+
for letter in random_word:
29+
if letter == guess:
30+
display += letter
31+
correct_letters.append(guess)
32+
elif letter in correct_letters:
33+
display += letter
34+
else:
35+
display += "_"
36+
print(f"Word: {display}")
37+
38+
# LOSE LIFE CONDITION
39+
if guess not in random_word:
40+
lives -= 1
41+
print(f"\n~~~You guessed {guess}, that's not in the word. You lost a life~~~")
42+
43+
# YOU LOSE CONDITION
44+
if lives == 0:
45+
game_over = True
46+
print(f"**************The correct word was: {random_word}! YOU LOSE**************")
47+
48+
# YOU WIN CONDITION
49+
if "_" not in display:
50+
game_over = True
51+
print(f"********************YOU WIN!********************")
52+
print(logo2)
53+
54+
print(stages[lives])

0 commit comments

Comments
 (0)