Created
June 17, 2023 14:29
-
-
Save horstjens/c526f99c3047f4b851384d42b3f766b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
words = [ | |
"teacher", | |
"classroom", | |
"window", | |
"door", | |
"tree", | |
"light", | |
"table", | |
"cupboard", | |
"cable", | |
"computer", | |
"mouse", | |
"monitor", | |
"camera", | |
"headphones", | |
"paper", | |
] | |
images = [ | |
r""" | |
============================= | |
""", | |
r""" | |
____________ | |
/ \ | |
/ \ | |
============================= | |
""", | |
r""" | |
| | |
| | |
| | |
| | |
| | |
____________ | |
/ \ | |
/ \ | |
============================= | |
""", | |
r""" | |
+---- | |
| | |
| | |
| | |
| | |
____________ | |
/ \ | |
/ \ | |
============================= | |
""", | |
r""" | |
_____ | |
| / | |
|/ | |
| | |
| | |
____________ | |
/ \ | |
/ \ | |
============================= | |
""", | |
r""" | |
_____ | |
| / ! | |
|/ | |
| | |
| | |
____________ | |
/ \ | |
/ \ | |
============================= | |
""", | |
r""" | |
_____ | |
| / ! | |
|/ O | |
| | |
| | |
____________ | |
/ \ | |
/ \ | |
============================= | |
""", | |
r""" | |
_____ | |
| / ! | |
|/ O | |
| I | |
| | |
____________ | |
/ \ | |
/ \ | |
============================= | |
""", | |
r""" | |
_____ | |
| / ! | |
|/ 0 | |
| /I | |
| | |
____________ | |
/ \ | |
/ \ | |
============================= | |
""", | |
r""" | |
_____ | |
| / ! | |
|/ 0 | |
| /I\ | |
| | |
____________ | |
/ \ | |
/ \ | |
============================= | |
""", | |
r""" | |
_____ | |
| / ! | |
|/ 0 | |
| /I\ | |
| / | |
____________ | |
/ \ | |
/ \ | |
============================= | |
""", | |
r""" | |
_____ | |
| / ! | |
|/ 0 | |
| /I\ | |
| / \ | |
____________ | |
/ \ | |
/ \ | |
============================= | |
""", | |
] | |
secret = random.choice(words) | |
hits = [] | |
misses = [] | |
i = 0 | |
while set(hits) < set(secret): | |
print(images[i]) | |
print("hits :", hits) | |
print("misses:", misses) | |
for char in secret: | |
if char in hits: | |
print(char, end="") | |
else: | |
print(".", end="") | |
print() | |
while True: | |
command = input("guess a letter: >>>") | |
if len(command.strip()) != 1: | |
print("one letter please") | |
continue | |
break | |
if command.lower() in secret.lower(): | |
if command.lower() not in hits: | |
hits.append(command.lower()) | |
else: | |
misses.append(command) | |
i += 1 | |
print(hits) | |
print("Game Over") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment