Skip to content

Commit 4e6a1a7

Browse files
cryptic_language_game.py
1 parent 0765566 commit 4e6a1a7

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import random
2+
3+
cryptic_language = {
4+
'A': 'Q', 'B': 'W', 'C': 'E', 'D': 'R', 'E': 'T',
5+
'F': 'Y', 'G': 'U', 'H': 'I', 'I': 'O', 'J': 'P',
6+
'K': 'A', 'L': 'S', 'M': 'D', 'N': 'F', 'O': 'G',
7+
'P': 'H', 'Q': 'J', 'R': 'K', 'S': 'L', 'T': 'Z',
8+
'U': 'X', 'V': 'C', 'W': 'V', 'X': 'B', 'Y': 'N',
9+
'Z': 'M'
10+
}
11+
12+
messages = [
13+
"HELLO WORLD",
14+
"CRYPTIC PUZZLE",
15+
"PYTHON IS FUN",
16+
"SOLVE THE CODE",
17+
"GREAT PUZZLE GAME",
18+
"LEARNING PYTHON",
19+
"CHALLENGE ACCEPTED",
20+
"UNLOCK THE MYSTERY",
21+
"ENJOY THE PUZZLES",
22+
"BECOME A MASTER",
23+
"DISCOVER THE SECRET",
24+
"EMBRACE THE UNKNOWN",
25+
"CRACK THE CIPHER",
26+
"DECODE AND WIN",
27+
"MASTER THE CODE",
28+
"UNVEIL THE TRUTH",
29+
"EXPLORE THE PUZZLE",
30+
"PUZZLE SOLVER",
31+
"MIND-BENDING FUN",
32+
"THINK OUTSIDE THE BOX"
33+
]
34+
35+
def generate_message():
36+
return random.choice(messages)
37+
38+
def play_game():
39+
player_name = input("Enter your name: ")
40+
print(f"Welcome, {player_name}, to the Cryptic Language Puzzle Game!")
41+
print("You need to decipher the message to progress.\n")
42+
43+
score = 0
44+
45+
while True:
46+
encrypted_message = generate_message()
47+
print("Decipher the following message:")
48+
print(encrypted_message)
49+
50+
guess = input("Enter your guess: ").upper()
51+
52+
if guess == encrypted_message:
53+
score += 1
54+
print("Congratulations! You deciphered the message.")
55+
print(f"Current Score: {score}\n")
56+
else:
57+
print("Incorrect guess. Try again.\n")
58+
59+
play_again = input("Do you want to play another round? (yes/no): ")
60+
if play_again.lower() != "yes":
61+
print(f"Thank you for playing, {player_name}!")
62+
print(f"Final Score: {score}")
63+
break
64+
65+
if __name__ == "__main__":
66+
play_game()

0 commit comments

Comments
 (0)