0% found this document useful (0 votes)
26 views28 pages

Manasa P CSC Ip

The document is an investigatory project titled 'Escape Room' submitted by Manasa P for Computer Science at The PSBB Millennium School. It outlines the creation of an interactive text-based escape room game using Python, detailing the program's objectives, logic, and source code. The project includes acknowledgments, a bonafide certificate, and an index of contents related to the game's development.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views28 pages

Manasa P CSC Ip

The document is an investigatory project titled 'Escape Room' submitted by Manasa P for Computer Science at The PSBB Millennium School. It outlines the creation of an interactive text-based escape room game using Python, detailing the program's objectives, logic, and source code. The project includes acknowledgments, a bonafide certificate, and an index of contents related to the game's development.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

THE PSBB MILLENNIUM SCHOOL

GERUGAMBAKKAM
SUBJECT: COMPUTER SCIENCE (083)
INVESTIGATORY PROJECT

ESCAPE ROOM

SUBMITTED BY:
NAME: MANASA P
ROLL NO:
STD: XII
AY:2025-2026

1|Page
BONAFIDE CERTIFICATE

This is to certify that the project entitled “ESCAPE ROOM” is a record of


bonafide work carried out by Manasa P of class XII – ‘B’ in THE PSBB
MILLENNIUM SCHOOL, GERUGAMBAKKAM during the year 2025-26
in partial fulfilment of the requirements in COMPUTER SCIENCE prescribed
by CBSE.

Submitted for Senior Secondary Practical Examination held in THE


PSBB MILLENNIUM SCHOOL, GERUGAMBAKKAM at COMPUTER
SCIENCE LAB.

DATE: _________ PRINCIPAL

INTERNAL EXAMINER EXTERNAL


EXAMINER

2|Page
ACKNOWLEDGEMENT
I am overwhelmed in all humbleness and gratefulness to acknowledge my depth to all those
who have helped me to put these ideas, well above the level of simplicity and into
something concrete.
I would like to express my heartfelt gratitude to my parents who helped me a lot in
gathering different information opportunity to do this wonderful project, which also helped
me in doing a lot of Research and I came to know about so many new things. I am really
thankful to them., collecting data and guiding me from time to time in making this project,
despite of their busy schedules, they gave me different ideas in making this project unique.
I would like to express my deepest gratitude to my brother for helping me in every step of
the way while putting together my project.
I would like to express my special thanks of gratitude to our principal Dr Bhavani Baskar, our
Vice Principal V R Vidyalakshmi and my computer science teacher and HOD Mrs Suguna Devi
Amirtharaj who gave me the golden opportunity to make this happen.
I would like to express my deep gratitude towards the almighty god for leading me to this
project and giving strength for its completion.
Without them I wouldn’t be able to complete this project.
Thank you.

3|Page
INDEX

[Link] CONTENT PAGE NO

1 Introduction to python 6

2 Program analysis 7

3 Source code 9

4 Sample Output 20

5 Future Scope 26

6 Result 27

7 References 28

4|Page
5|Page
INTRODUCTION TO PYTHON
Python is an easy to use, interpreted, high-level programming language. It is an expressive
language that has so many convenient features which makes it highly user friendly. Python’s
simple syntax and high readability reduces the cost for program maintenance and makes it
really efficient. Often, programmers fall in love with Python because of the increased
productivity it provides and a lot of useful and fun applications and software can be made
with it. Including this fun little game ‘ESCAPE ROOM’.

Although it is not perfect, yet it has a lot of pluses and strengths which helped me in a lot of
ways to complete this project in time. Firstly, it is an interpreted language which means
there is no compilation step and the edit-test-debug cycle is incredibly fast. I could
repeatedly test the program and make the necessary changes then and there itself without
the need to complete the code. Speaking of completing the program, I could not take the
computer along with me wherever I go. But python’s portability made it even easier to use.
It’s a multi-platform language so, I would type the code using other devices whenever its
convenient. Especially I used my smartphone to design the ASCII character for hangman. For
completing this program, I had to use few modules for specific functions. There was no need
to download those additional libraries because you get everything while installing python.
Its completeness is surely an advantage.

6|Page
PROGRAM ANALYSIS
AIM:
To design and implement an interactive, text-based escape room game in Python where
players solve a sequence of logic-based puzzles within limited attempts and limited hints,
across different difficulty modes.

OBJECTIVE:
1. Create an interactive gameplay system using console inputs and printed ASCII art to
enhance immersion.
2. Implement multiple puzzles (5 in Easy, 10 in Medium, 15 in Hard) each requiring logical
reasoning or riddle-solving.
3. Provide a controlled challenge through:
 Limited attempts per puzzle (2 tries)
 Limited hints depending on difficulty
4. Track user performance including:
 Total attempts
 Time taken
 Difficulty chosen
 Final result (Win/Loss)
5. Store player results in a persistent text file (escape_records.txt) for future reference.
6. Allow restart capability when the player fails a puzzle, without crashing or terminating
the program.

7|Page
LOGIC USED:
Module used: time module
 The game starts by asking the user’s name and difficulty level (Easy/Medium/Hard).
 Based on difficulty, the program:
o Sets the number of hints.
o Selects the required puzzle functions in sequence.
 Each puzzle:
o Shows a riddle or question.
o Accepts up to two attempts.
o Allows the user to type "hint", which reduces the global hint counter.
o Returns True/False depending on whether the puzzle was cleared.
 If a puzzle is failed, the player can restart the full game or quit.
 A global attempt counter records how many attempts were used across all puzzles.
 The total duration is measured using Python’s [Link]().
 At the end (win or loss), the program writes details like:
o Player name
o Difficulty
o Attempts
o Result
o Time taken
to escape_records.txt using a file-handling function.

8|Page
SOURCE CODE
import time

def save_result(name, attempts, result, duration):


with open("escape_records.txt", "a") as f:
[Link](f"Player: {name}\n")
[Link](f"Difficulty: {DIFFICULTY}\n")
[Link](f"Attempts: {attempts}\n")
[Link](f"Result: {result}\n")
[Link](f"Time: {duration:.2f} seconds\n")
[Link]("-" * 50 + "\n")
print("Result saved to escape_records.txt")

#-----
HINTS_REMAINING = 0
DIFFICULTY = "Unknown"

def check_answer(user_input, correct_answer):


if user_input is None:
return False
return user_input.strip().lower() == correct_answer.lower()

# puzzle1:

def puzzle_1():
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ ___
/ __ \/ __ \/ __ \/ |/ / _ < /
/ /_/ / / / / / / / /|_/ / (_) / /
/ _, _/ /_/ / /_/ / / / / _ / /
/_/ |_|\____/\____/_/ /_/ (_) /_/

The castle gate bears a plaque with etched numbers.""")


print("\nYou have 2 tries. You may type 'hint' to consume a hint.")
attempts_here = 0

attempts_here += 1
ans = input("\nInscription: 'Two cubed plus one, but the digits reversed.'
Enter the 3-digit code: ").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:
HINTS_REMAINING -= 1
print("\nHINT: 2^3 + 1 , reverse the order'.")
ans = input("\nNow enter the 3-digit code: ").strip()
else:
print("\nNo hints remaining.")
ans = input("\nEnter the 3-digit code: ").strip()

if check_answer(ans, "321"):
print(" \nThe heavy gate grinds open.")
return True, attempts_here

attempts_here += 1
ans2 = input("\nWrong. Final try for Room 1: ").strip()
if check_answer(ans2, "321"):
print("\nCorrect on second attempt; the gate opens with a groan.")
return True, attempts_here
else:
print("\nBoth tries failed. The guards remain asleep but the gate won't
budge.")
return False, attempts_here

# Puzzle 2:

9|Page
def puzzle_2():
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ ___
/ __ \/ __ \/ __ \/ |/ / _ |__ \
/ /_/ / / / / / / / /|_/ / (_) __/ /
/ _, _/ /_/ / /_/ / / / / _ / __/
/_/ |_|\____/\____/_/ /_/ (_) /____/

In the courtyard, a minstrel's riddle is pinned to a post.""")


attempts_here = 0

attempts_here += 1
ans = input("\nRiddle: 'I speak without a mouth and hear without ears. Who am
I?' ").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:
HINTS_REMAINING -= 1
print("\nHINT: It returns your voice.")
ans = input("Your answer: ").strip()
else:
print("\nNo hints left.")
ans = input("Your answer: ").strip()

if "echo" in [Link]():
print("\nThe minstrel nods; a key falls from the post.")
return True, attempts_here

attempts_here += 1
ans2 = input("\nWrong. Final try for Room 2: ").strip()
if "echo" in [Link]():
print("\nCorrect on second attempt; the key clinks to the ground.")
return True, attempts_here
else:
print("\n Both tries failed. The minstrel shrugs and walks away.")
return False, attempts_here

# Puzzle 3:

def puzzle_3():
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ _____
/ __ \/ __ \/ __ \/ |/ / _ |__ /
/ /_/ / / / / / / / /|_/ / (_) /_ <
/ _, _/ /_/ / /_/ / / / / _ ___/ /
/_/ |_|\____/\____/_/ /_/ (_) /____/

Two archways stand: one scorched, one mossy.""")


attempts_here = 0

attempts_here += 1
ans = input("\nWhich archway do you take? ('scorched' or 'mossy'): ").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:
HINTS_REMAINING -= 1
print("\nHINT: Flames are not friendly to travelers.")
ans = input("\nWhich archway: ").strip()
else:
print("\nNo hints left.")
ans = input("\nWhich archway: ").strip()

if [Link]() == "mossy":
print("\n You slide past thorn and come into a hidden garden.")
return True, attempts_here

10 | P a g e
attempts_here += 1
ans2 = input("\nWrong. Final try for Room 3 (scorched/mossy): ").strip()
if [Link]() == "mossy":
print("\nCorrect on second attempt.")
return True, attempts_here
else:
print("\n Both tries failed. A scorch mark warns you to beware.")
return False, attempts_here

# Puzzle 4:

def puzzle_4():
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ __ __
/ __ \/ __ \/ __ \/ |/ / _ / // /
/ /_/ / / / / / / / /|_/ / (_) / // /_
/ _, _/ /_/ / /_/ / / / / _ /__ __/
/_/ |_|\____/\____/_/ /_/ (_) /_/

A chest has scrambled letters painted in old ink.""")


attempts_here = 0

attempts_here += 1
ans = input("\nUnscramble 'S W O R D' (type the word): ").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:
HINTS_REMAINING -= 1
print("\nHINT: A knight's favored armament.")
ans = input("Unscramble now: ").strip()
else:
print("\nNo hints left.")
ans = input("Unscramble now: ").strip()

if check_answer(ans, "sword"):
print("\nCorrect — inside lies a forged token.")
return True, attempts_here

attempts_here += 1
ans2 = input("\nWrong. Final try for Room 4: ").strip()
if check_answer(ans2, "sword"):
print("\nCorrect on second try; token added to your pouch.")
return True, attempts_here
else:
print("\n Both tries failed. The chest stays locked.")
return False, attempts_here

# Puzzle 5:

def puzzle_5():
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ ______
/ __ \/ __ \/ __ \/ |/ / _ / ____/
/ /_/ / / / / / / / /|_/ / (_) /___ \
/ _, _/ /_/ / /_/ / / / / _ ____/ /
/_/ |_|\____/\____/_/ /_/ (_) /_____/

A fresco displays a half-faded proverb.""")


attempts_here = 0

attempts_here += 1
ans = input("\nComplete: 'A kingdom divided cannot ___' : ").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:

11 | P a g e
HINTS_REMAINING -= 1
print("\nHINT: Think of 'stand' or 'survive'.")
ans = input("\nComplete the proverb: ").strip()
else:
print("\nNo hints left.")
ans = input("\nComplete the proverb: ").strip()

if check_answer(ans, "stand"):
print("\n The fresco slides; a secret stair reveals itself.")
return True, attempts_here

attempts_here += 1
ans2 = input("\nWrong. Final try for Room 5: ").strip()
if check_answer(ans2, "stand"):
print("\nCorrect on second try; the stair appears.")
return True, attempts_here
else:
print("\n Both tries failed. The fresco remains stubborn.")
return False, attempts_here

# Puzzle 6:

def puzzle_6():
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ _____
/ __ \/ __ \/ __ \/ |/ / _ / ___/
/ /_/ / / / / / / / /|_/ / (_) / __ \
/ _, _/ /_/ / /_/ / / / / _ / /_/ /
/_/ |_|\____/\____/_/ /_/ (_) \____/

A mosaic shows three shields: lion, raven, oak.""")


attempts_here = 0

attempts_here += 1
ans = input("\nWhich shield stands for courage? ('lion'/'raven'/'oak'):
").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:
HINTS_REMAINING -= 1
print("\nHINT: Think of the king's crest.")
ans = input("Your choice: ").strip()
else:
print("\nNo hints left.")
ans = input("\nYour choice: ").strip()

if [Link]() == "lion":
print("\n Correct — a panel opens showing a small key.")
return True, attempts_here

attempts_here += 1
ans2 = input("\nWrong. Final try for Room 6: ").strip()
if [Link]() == "lion":
print("\nCorrect on second try.")
return True, attempts_here
else:
print("\n Both tries failed. The mosaic remains blank.")
return False, attempts_here

# Puzzle 7:

def puzzle_7():
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ _____
/ __ \/ __ \/ __ \/ |/ / _ /__ /

12 | P a g e
/ /_/ / / / / / / / /|_/ / (_) / /
/ _, _/ /_/ / /_/ / / / / _ / /
/_/ |_|\____/\____/_/ /_/ (_) /_/

A locked gate asks for a password; plaque reads 'Light's


opposite'.""")
attempts_here = 0

attempts_here += 1
ans = input("\nEnter password: ").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:
HINTS_REMAINING -= 1
print("\nHINT: It begins with 'd' and ends with 'k'.")
ans = input("\nNow enter password: ").strip()
else:
print("\nNo hints left.")
ans = input("\nEnter password: ").strip()

if check_answer(ans, "dark"):
print("\n Password accepted; the gate unlatches.")
return True, attempts_here

attempts_here += 1
ans2 = input("\nWrong. Final try for Room 7: ").strip()
if check_answer(ans2, "dark"):
print("\n Correct on second try; gate swings open.")
return True, attempts_here
else:
print("\n Both tries failed. The gate remains shut.")
return False, attempts_here

# Puzzle 8:

def puzzle_8():
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ ____
/ __ \/ __ \/ __ \/ |/ / _ ( __ )
/ /_/ / / / / / / / /|_/ / (_) / __ |
/ _, _/ /_/ / /_/ / / / / _ / /_/ /
/_/ |_|\____/\____/_/ /_/ (_) \____/

A painter's table holds three colored vials.""")


attempts_here = 0

attempts_here += 1
ans = input("\nRed + Blue = ? (type the color): ").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:
HINTS_REMAINING -= 1
print("\nHINT: Think of royal robes.")
ans = input("Red + Blue = ? ").strip()
else:
print("\nNo hints left.")
ans = input("\nRed + Blue = ? ").strip()

if check_answer(ans, "purple"):
print("\n Correct — the painter reveals a map fragment.")
return True, attempts_here

attempts_here += 1
ans2 = input("\nWrong. Final try for Room 8: ").strip()
if check_answer(ans2, "purple"):
print("\n Correct on second try.")
return True, attempts_here
else:

13 | P a g e
print("\n Both tries failed. Paint spills and hides the fragment.")
return False, attempts_here

# Puzzle 9:

def puzzle_9():
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ ____
/ __ \/ __ \/ __ \/ |/ / _ / __ \
/ /_/ / / / / / / / /|_/ / (_) / /_/ /
/ _, _/ /_/ / /_/ / / / / _ \__, /
/_/ |_|\____/\____/_/ /_/ (_) /____/

A wooden table holds four objects.""")


attempts_here = 0

attempts_here += 1
ans = input("\nWhich does not belong? 'Goblet, Chalice, Spoon, Crown'
").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:
HINTS_REMAINING -= 1
print("\nHINT: One is used for eating.")
ans = input("\nYour answer: ").strip()
else:
print("\nNo hints left.")
ans = input("\nYour answer: ").strip()

if check_answer(ans, "spoon"):
print("\n Correct — the spoon points to a hidden latch.")
return True, attempts_here

attempts_here += 1
ans2 = input("\nWrong. Final try for Room 9: ").strip()
if check_answer(ans2, "spoon"):
print("\n Correct on second try.")
return True, attempts_here
else:
print("\n Both tries failed. Objects remain as they were.")
return False, attempts_here

# Puzzle 10:

def puzzle_10():
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ _______
/ __ \/ __ \/ __ \/ |/ / _ < / __ \
/ /_/ / / / / / / / /|_/ / (_) / / / / /
/ _, _/ /_/ / /_/ / / / / _ / / /_/ /
/_/ |_|\____/\____/_/ /_/ (_) /_/\____/

A weathered scroll asks for a cloth that dries yet gets wet.""")
attempts_here = 0

attempts_here += 1
ans = input("\nWhat gets wetter as it dries? ").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:
HINTS_REMAINING -= 1
print("\nHINT: You use it after bath.")
ans = input("\nYour answer: ").strip()
else:
print("\nNo hints left.")
ans = input("\nYour answer: ").strip()

14 | P a g e
if check_answer(ans, "towel"):
print("\n Correct — a seam yields a brass key.")
return True, attempts_here

attempts_here += 1
ans2 = input("\nWrong. Final try for Room 10: ").strip()
if check_answer(ans2, "towel"):
print("\n Correct on second try.")
return True, attempts_here
else:
print("\n Both tries failed. The seam hides its secret still.")
return False, attempts_here

# Puzzle 11:

def puzzle_11():
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ ______
/ __ \/ __ \/ __ \/ |/ / _ < < /
/ /_/ / / / / / / / /|_/ / (_) / // /
/ _, _/ /_/ / /_/ / / / / _ / // /
/_/ |_|\____/\____/_/ /_/ (_) /_//_/

A scholar's desk has letters: 'I have cities but no houses...'""")


attempts_here = 0

attempts_here += 1
ans = input("\nRiddle: 'I have cities but no houses...' What am I? ").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:
HINTS_REMAINING -= 1
print("\nHINT: You read me to travel the land without moving.")
ans = input("Your response: ").strip()
else:
print("\nNo hints left.")
ans = input("Your response: ").strip()

if check_answer(ans, "map"):
print("\n️Correct — the map shows a secret corridor.")
return True, attempts_here

attempts_here += 1
ans2 = input("\nWrong. Final try for Room 11: ").strip()
if check_answer(ans2, "map"):
print("\n Correct on second try.")
return True, attempts_here
else:
print("\n Both tries failed. The scholar sighs.")
return False, attempts_here

# Puzzle 12:

def puzzle_12():
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ ______
/ __ \/ __ \/ __ \/ |/ / _ < /__ \
/ /_/ / / / / / / / /|_/ / (_) / /__/ /
/ _, _/ /_/ / /_/ / / / / _ / // __/
/_/ |_|\____/\____/_/ /_/ (_) /_//____/

A brazier bears a riddle about feeding and drinking.""")


attempts_here = 0

15 | P a g e
attempts_here += 1
ans = input("\nRiddle: 'Feed me and I live, give me a drink and I die.' What am
I? ").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:
HINTS_REMAINING -= 1
print("\nHINT: The hearth uses me.")
ans = input("\nAnswer: ").strip()
else:
print("\nNo hints left.")
ans = input("\nAnswer: ").strip()

if check_answer(ans, "fire"):
print("\nCorrect — embers show a glowing rune.")
return True, attempts_here

attempts_here += 1
ans2 = input("\nWrong. Final try for Room 12: ").strip()
if check_answer(ans2, "fire"):
print("\n Correct on second try.")
return True, attempts_here
else:
print("\n Both tries failed. The brazier cools.")
return False, attempts_here

# Puzzle 13:

def puzzle_13():
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ ________
/ __ \/ __ \/ __ \/ |/ / _ < /__ /
/ /_/ / / / / / / / /|_/ / (_) / / /_ <
/ _, _/ /_/ / /_/ / / / / _ / /___/ /
/_/ |_|\____/\____/_/ /_/ (_) /_//____/

A tailor's box shows 'one eye but cannot see'.""")


attempts_here = 0

attempts_here += 1
ans = input("\nWhat has one eye but cannot see? ").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:
HINTS_REMAINING -= 1
print("\nHINT: It's used with thread.")
ans = input("\nYour answer: ").strip()
else:
print("\nNo hints left.")
ans = input("\nYour answer: ").strip()

if check_answer(ans, "needle"):
print("\n Correct — the needle points to a loose stone.")
return True, attempts_here

attempts_here += 1
ans2 = input("\nWrong. Final try for Room 13: ").strip()
if check_answer(ans2, "needle"):
print("\n Correct on second try.")
return True, attempts_here
else:
print("\n Both tries failed. The tailoring kit remains quiet.")
return False, attempts_here

# Puzzle 14:

def puzzle_14():

16 | P a g e
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ _____ __
/ __ \/ __ \/ __ \/ |/ / _ < / // /
/ /_/ / / / / / / / /|_/ / (_) / / // /_
/ _, _/ /_/ / /_/ / / / / _ / /__ __/
/_/ |_|\____/\____/_/ /_/ (_) /_/ /_/

A candle stub and wax riddle.""")


attempts_here = 0

attempts_here += 1
ans = input("\nRiddle: 'I'm tall when I'm young and short when I'm old.' What
am I? ").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:
HINTS_REMAINING -= 1
print("\nHINT: You light it to see in the dark.")
ans = input("\nAnswer: ").strip()
else:
print("\nNo hints left.")
ans = input("\nAnswer: ").strip()

if check_answer(ans, "candle"):
print("\n️Correct — the candle's flame reveals a symbol.")
return True, attempts_here

attempts_here += 1
ans2 = input("\nWrong. Final try for Room 14: ").strip()
if check_answer(ans2, "candle"):
print("\n Correct on second try.")
return True, attempts_here
else:
print("\n Both tries failed. The candle remains stubby.")
return False, attempts_here

# Puzzle 15:

def puzzle_15():
global HINTS_REMAINING
print("""\n
____ ____ ____ __ ___ _________
/ __ \/ __ \/ __ \/ |/ / _ < / ____/
/ /_/ / / / / / / / /|_/ / (_) / /___ \
/ _, _/ /_/ / /_/ / / / / _ / /___/ /
/_/ |_|\____/\____/_/ /_/ (_) /_/_____/

Final chamber: a massive iron door with inscription.""")


attempts_here = 0

attempts_here += 1
ans = input("\nComplete: 'If two's company and three's a crowd, what are four
and five?' (type numeral or word): ").strip()
if [Link]() == "hint":
if HINTS_REMAINING > 0:
HINTS_REMAINING -= 1
print("\nHINT: Sum the two numbers.")
ans = input("\nYour answer: ").strip()
else:
print("\nNo hints left.")
ans = input("\nYour answer: ").strip()

if [Link]() == "9" or [Link]() == "nine":


print("\n Correct — the iron door creaks open. Freedom.")
return True, attempts_here

attempts_here += 1

17 | P a g e
ans2 = input("\nWrong. Final try for Final Room: ").strip()
if [Link]() == "9" or [Link]() == "nine":
print("\n Correct on second try — the door yields!")
return True, attempts_here
else:
print("\nBoth tries failed. The iron door remains sealed.")
return False, attempts_here

# -----
def escape_room():
global HINTS_REMAINING, DIFFICULTY

print("""//////////////////////////////////////////////////////////////////////////
/

_ _ ___ __ __ __ __ __ ___ ____ __


( \/\/ )( _)( ) / _)/ \( \/ )( _) (_ _)/ \
\ / ) _) )(__( (_( () )) ( ) _) )( ( () )
\/\/ (___)(____)\__)\__/(_/\/\_)(___) (__) \__/

___________ _________ ____ ______ ____ ____ ____ __ ___


/ ____/ ___// ____/ | / __ \/ ____/ / __ \/ __ \/ __ \/ |/ /
/ __/ \__ \/ / / /| | / /_/ / __/ / /_/ / / / / / / / /|_/ /
/ /___ ___/ / /___/ ___ |/ ____/ /___ / _, _/ /_/ / /_/ / / / /
/_____//____/\____/_/ |_/_/ /_____/ /_/ |_|\____/\____/_/ /_/

///////////////////////////////////////////////////////////////////////
/////

""" )
name = input("ENTER YOUR NAME /BRAVE SOUL/:").strip()
print("\nCHOOSE DIFFICULTY:")
print("1) Easy - 5 puzzles (5 hints)")
print("2) Medium -10 puzzles (3 hints)")
print("3) Hard -15 puzzles (1 hint)")
choice = input("Enter 1, 2, or 3: ").strip()

# easy:
if choice == "1":
DIFFICULTY = "Easy"
HINTS_REMAINING = 5
print("\nYou chose /EASY/. You have 5 hints for the whole game.")
total_attempts = 0
start_time = [Link]()

for p in [puzzle_1, puzzle_2, puzzle_3, puzzle_4, puzzle_5]:


ok, a = p()
total_attempts += a
if not ok:
choice = input("do u want to restart yes/no")
if choice == "no" :
save_result(name, total_attempts, "Loss", [Link]() -
start_time)
return
elif choice == "yes" :
escape_room()

duration = [Link]() - start_time


print(f"""\n CONGRATULATIONS {name}!
You escaped the castle on EASY
in {total_attempts} attempts and
{duration:.2f} seconds.""")
save_result(name, total_attempts, "Win", duration)

18 | P a g e
return

# medium:
elif choice == "2":
DIFFICULTY = "Medium"
HINTS_REMAINING = 3
print("\nYou chose MEDIUM. You have 3 hints for the whole game.")
total_attempts = 0
start_time = [Link]()

for p in [puzzle_1, puzzle_2, puzzle_3, puzzle_4, puzzle_5,


puzzle_6, puzzle_7, puzzle_8, puzzle_9, puzzle_10]:
ok, a = p()
total_attempts += a
if not ok:
choice = input("do u want to restart yes/no")
if choice == "no" :
save_result(name, total_attempts, "Loss", [Link]() -
start_time)
return
elif choice == "yes" :
escape_room()

duration = [Link]() - start_time


print(f"""\n CONGRATULATIONS {name}!
You escaped the castle on MEDIUM
in {total_attempts} attempts and
{duration:.2f} seconds.""")
save_result(name, total_attempts, "Win", duration)
return

# hard:
elif choice == "3":
DIFFICULTY = "Hard"
HINTS_REMAINING = 1
print("\nYou chose HARD. You have 1 hint for the whole game. Good luck.")
total_attempts = 0
start_time = [Link]()

for p in [puzzle_1, puzzle_2, puzzle_3, puzzle_4, puzzle_5,


puzzle_6, puzzle_7, puzzle_8, puzzle_9, puzzle_10,
puzzle_11, puzzle_12, puzzle_13, puzzle_14, puzzle_15]:
ok, a = p()
total_attempts += a
if not ok:
choice = input("do u want to restart yes/no")
if choice == "no" :
save_result(name, total_attempts, "Loss", [Link]() -
start_time)
return
elif choice == "yes" :
escape_room()

duration = [Link]() - start_time


print(f"""\n CONGRATULATIONS {name}!
You escaped the castle on HARD
in {total_attempts} attempts and
{duration:.2f} seconds.""")
save_result(name, total_attempts, "Win", duration)
return

else:
print(" Invalid choice. Restart the game.")

# Run game
escape_room()

19 | P a g e
SAMPLE OUTPUTS
Winning without clues:
///////////////////////////////////////////////////////////////////////////

_ _ ___ __ __ __ __ __ ___ ____ __


( \/\/ )( _)( ) / _)/ \( \/ )( _) (_ _)/ \
\ / ) _) )(__( (_( () )) ( ) _) )( ( () )
\/\/ (___)(____)\__)\__/(_/\/\_)(___) (__) \__/

___________ _________ ____ ______ ____ ____ ____ __ ___


/ ____/ ___// ____/ | / __ \/ ____/ / __ \/ __ \/ __ \/ |/ /
/ __/ \__ \/ / / /| | / /_/ / __/ / /_/ / / / / / / / /|_/ /
/ /___ ___/ / /___/ ___ |/ ____/ /___ / _, _/ /_/ / /_/ / / / /
/_____//____/\____/_/ |_/_/ /_____/ /_/ |_|\____/\____/_/ /_/

///////////////////////////////////////////////////////////////////////
/////

ENTER YOUR NAME /BRAVE SOUL/:Chandana

CHOOSE DIFFICULTY:
1) Easy - 5 puzzles (5 hints)
2) Medium -10 puzzles (3 hints)
3) Hard -15 puzzles (1 hint)
Enter 1, 2, or 3: 1

You chose /EASY/. You have 5 hints for the whole game.

____ ____ ____ __ ___ ___


/ __ \/ __ \/ __ \/ |/ / _ < /
/ /_/ / / / / / / / /|_/ / (_) / /
/ _, _/ /_/ / /_/ / / / / _ / /
/_/ |_|\____/\____/_/ /_/ (_) /_/

The castle gate bears a plaque with etched numbers.

You have 2 tries. You may type 'hint' to consume a hint.

Inscription: 'Two cubed plus one, but the digits reversed.' Enter the 3-digit code:
321

The heavy gate grinds open.

____ ____ ____ __ ___ ___


/ __ \/ __ \/ __ \/ |/ / _ |__ \
/ /_/ / / / / / / / /|_/ / (_) __/ /
/ _, _/ /_/ / /_/ / / / / _ / __/
/_/ |_|\____/\____/_/ /_/ (_) /____/

In the courtyard, a minstrel's riddle is pinned to a post.

20 | P a g e
Riddle: 'I speak without a mouth and hear without ears. Who am I?' echo

The minstrel nods; a key falls from the post.

____ ____ ____ __ ___ _____


/ __ \/ __ \/ __ \/ |/ / _ |__ /
/ /_/ / / / / / / / /|_/ / (_) /_ <
/ _, _/ /_/ / /_/ / / / / _ ___/ /
/_/ |_|\____/\____/_/ /_/ (_) /____/

Two archways stand: one scorched, one mossy.

Which archway do you take? ('scorched' or 'mossy'): mossy

You slide past thorn and come into a hidden garden.

____ ____ ____ __ ___ __ __


/ __ \/ __ \/ __ \/ |/ / _ / // /
/ /_/ / / / / / / / /|_/ / (_) / // /_
/ _, _/ /_/ / /_/ / / / / _ /__ __/
/_/ |_|\____/\____/_/ /_/ (_) /_/

A chest has scrambled letters painted in old ink.

Unscramble 'S W O R D' (type the word): sword

Correct — inside lies a forged token.

____ ____ ____ __ ___ ______


/ __ \/ __ \/ __ \/ |/ / _ / ____/
/ /_/ / / / / / / / /|_/ / (_) /___ \
/ _, _/ /_/ / /_/ / / / / _ ____/ /
/_/ |_|\____/\____/_/ /_/ (_) /_____/

A fresco displays a half-faded proverb.

Complete: 'A kingdom divided cannot ___' : stand

The fresco slides; a secret stair reveals itself.

CONGRATULATIONS Chandana!
You escaped the castle on EASY
in 5 attempts and
16.31 seconds.
Result saved to escape_records.txt

Winning with clues:

///////////////////////////////////////////////////////////////////////////

_ _ ___ __ __ __ __ __ ___ ____ __


( \/\/ )( _)( ) / _)/ \( \/ )( _) (_ _)/ \
\ / ) _) )(__( (_( () )) ( ) _) )( ( () )
\/\/ (___)(____)\__)\__/(_/\/\_)(___) (__) \__/

___________ _________ ____ ______ ____ ____ ____ __ ___

21 | P a g e
/ ____/ ___// ____/ | / __ \/ ____/ / __ \/ __ \/ __ \/ |/ /
/ __/ \__ \/ / / /| | / /_/ / __/ / /_/ / / / / / / / /|_/ /
/ /___ ___/ / /___/ ___ |/ ____/ /___ / _, _/ /_/ / /_/ / / / /
/_____//____/\____/_/ |_/_/ /_____/ /_/ |_|\____/\____/_/ /_/

///////////////////////////////////////////////////////////////////////
/////

ENTER YOUR NAME /BRAVE SOUL/:Sai

CHOOSE DIFFICULTY:
1) Easy - 5 puzzles (5 hints)
2) Medium -10 puzzles (3 hints)
3) Hard -15 puzzles (1 hint)
Enter 1, 2, or 3: 1

You chose /EASY/. You have 5 hints for the whole game.

____ ____ ____ __ ___ ___


/ __ \/ __ \/ __ \/ |/ / _ < /
/ /_/ / / / / / / / /|_/ / (_) / /
/ _, _/ /_/ / /_/ / / / / _ / /
/_/ |_|\____/\____/_/ /_/ (_) /_/

The castle gate bears a plaque with etched numbers.

You have 2 tries. You may type 'hint' to consume a hint.

Inscription: 'Two cubed plus one, but the digits reversed.' Enter the 3-digit code:
123

Wrong. Final try for Room 1: 321

Correct on second attempt; the gate opens with a groan.

____ ____ ____ __ ___ ___


/ __ \/ __ \/ __ \/ |/ / _ |__ \
/ /_/ / / / / / / / /|_/ / (_) __/ /
/ _, _/ /_/ / /_/ / / / / _ / __/
/_/ |_|\____/\____/_/ /_/ (_) /____/

In the courtyard, a minstrel's riddle is pinned to a post.

Riddle: 'I speak without a mouth and hear without ears. Who am I?' echo

The minstrel nods; a key falls from the post.

____ ____ ____ __ ___ _____


/ __ \/ __ \/ __ \/ |/ / _ |__ /
/ /_/ / / / / / / / /|_/ / (_) /_ <
/ _, _/ /_/ / /_/ / / / / _ ___/ /
/_/ |_|\____/\____/_/ /_/ (_) /____/

Two archways stand: one scorched, one mossy.

Which archway do you take? ('scorched' or 'mossy'): scorched

22 | P a g e
Wrong. Final try for Room 3 (scorched/mossy): mossy

Correct on second attempt.

____ ____ ____ __ ___ __ __


/ __ \/ __ \/ __ \/ |/ / _ / // /
/ /_/ / / / / / / / /|_/ / (_) / // /_
/ _, _/ /_/ / /_/ / / / / _ /__ __/
/_/ |_|\____/\____/_/ /_/ (_) /_/

A chest has scrambled letters painted in old ink.

Unscramble 'S W O R D' (type the word): sword

Correct — inside lies a forged token.

____ ____ ____ __ ___ ______


/ __ \/ __ \/ __ \/ |/ / _ / ____/
/ /_/ / / / / / / / /|_/ / (_) /___ \
/ _, _/ /_/ / /_/ / / / / _ ____/ /
/_/ |_|\____/\____/_/ /_/ (_) /_____/

A fresco displays a half-faded proverb.

Complete: 'A kingdom divided cannot ___' : win

Wrong. Final try for Room 5: stand

Correct on second try; the stair appears.

CONGRATULATIONS Sai!
You escaped the castle on EASY
in 8 attempts and
41.14 seconds.
Result saved to escape_records.txt

Losing:
///////////////////////////////////////////////////////////////////////////

_ _ ___ __ __ __ __ __ ___ ____ __


( \/\/ )( _)( ) / _)/ \( \/ )( _) (_ _)/ \
\ / ) _) )(__( (_( () )) ( ) _) )( ( () )
\/\/ (___)(____)\__)\__/(_/\/\_)(___) (__) \__/

___________ _________ ____ ______ ____ ____ ____ __ ___


/ ____/ ___// ____/ | / __ \/ ____/ / __ \/ __ \/ __ \/ |/ /
/ __/ \__ \/ / / /| | / /_/ / __/ / /_/ / / / / / / / /|_/ /
/ /___ ___/ / /___/ ___ |/ ____/ /___ / _, _/ /_/ / /_/ / / / /
/_____//____/\____/_/ |_/_/ /_____/ /_/ |_|\____/\____/_/ /_/

///////////////////////////////////////////////////////////////////////
/////

ENTER YOUR NAME /BRAVE SOUL/:Manasa

23 | P a g e
CHOOSE DIFFICULTY:
1) Easy - 5 puzzles (5 hints)
2) Medium -10 puzzles (3 hints)
3) Hard -15 puzzles (1 hint)
Enter 1, 2, or 3: 1

You chose /EASY/. You have 5 hints for the whole game.

____ ____ ____ __ ___ ___


/ __ \/ __ \/ __ \/ |/ / _ < /
/ /_/ / / / / / / / /|_/ / (_) / /
/ _, _/ /_/ / /_/ / / / / _ / /
/_/ |_|\____/\____/_/ /_/ (_) /_/

The castle gate bears a plaque with etched numbers.

You have 2 tries. You may type 'hint' to consume a hint.

Inscription: 'Two cubed plus one, but the digits reversed.' Enter the 3-digit code:
123

Wrong. Final try for Room 1: 321

Correct on second attempt; the gate opens with a groan.

____ ____ ____ __ ___ ___


/ __ \/ __ \/ __ \/ |/ / _ |__ \
/ /_/ / / / / / / / /|_/ / (_) __/ /
/ _, _/ /_/ / /_/ / / / / _ / __/
/_/ |_|\____/\____/_/ /_/ (_) /____/

In the courtyard, a minstrel's riddle is pinned to a post.

Riddle: 'I speak without a mouth and hear without ears. Who am I?' echo

The minstrel nods; a key falls from the post.

____ ____ ____ __ ___ _____


/ __ \/ __ \/ __ \/ |/ / _ |__ /
/ /_/ / / / / / / / /|_/ / (_) /_ <
/ _, _/ /_/ / /_/ / / / / _ ___/ /
/_/ |_|\____/\____/_/ /_/ (_) /____/

Two archways stand: one scorched, one mossy.

Which archway do you take? ('scorched' or 'mossy'): scorched

Wrong. Final try for Room 3 (scorched/mossy): mossy

Correct on second attempt.

____ ____ ____ __ ___ __ __


/ __ \/ __ \/ __ \/ |/ / _ / // /
/ /_/ / / / / / / / /|_/ / (_) / // /_
/ _, _/ /_/ / /_/ / / / / _ /__ __/
/_/ |_|\____/\____/_/ /_/ (_) /_/

24 | P a g e
A chest has scrambled letters painted in old ink.

Unscramble 'S W O R D' (type the word): words

Wrong. Final try for Room 4: sword

Correct on second try; token added to your pouch.

____ ____ ____ __ ___ ______


/ __ \/ __ \/ __ \/ |/ / _ / ____/
/ /_/ / / / / / / / /|_/ / (_) /___ \
/ _, _/ /_/ / /_/ / / / / _ ____/ /
/_/ |_|\____/\____/_/ /_/ (_) /_____/

A fresco displays a half-faded proverb.

Complete: 'A kingdom divided cannot ___' : win

Wrong. Final try for Room 5: lose

Both tries failed. The fresco remains stubborn.


do u want to restart yes/no no
Result saved to escape_records.txt

#if the player had chosen to restart, then the game restarts#

Continues….

25 | P a g e
FUTURE SCOPE OF THE PROJECT:
1. Multi-Room Expansion:
Instead of a single hidden room, the game can be expanded into a series of interconnected
rooms, each with unique puzzles and clues.
2. Inventory System:
Players can collect keys, codes, tools, and other items, forcing them to think about when
and where to use each one.
3. Branching Storyline:
Different decisions can lead to alternate endings — escape, fail, bonus rooms, secret
endings, etc.
4. Timed Challenges:
Adding a countdown timer or time-penalty system can increase tension and realism.
5. Hint Mechanism:
A limited hint system can make the game accessible without making the puzzles too easy.
6. Improved Puzzle Variety:
More puzzle types — pattern decoding, number locks, riddles, clue-matching, or logic mini-
games — can deepen gameplay.
7. Better User Interface:
Shifting from plain text to a GUI using Tkinter, PyGame, or even a web version will make the
game more engaging.
8. Sound & Atmosphere:
Background suspense music, door creaks, and clue-triggered sound effects can create a
more immersive escape-room feel.
9. Replay Value:
Randomized puzzle answers each time the game starts so players can’t just memorize
solutions.
10. Save & Resume System:
Players can save their progress and return later — useful when puzzles get more complex.

26 | P a g e
RESULT:
We ran the above program in python and played the game. The data of the players were
saved in the escape records text file as and when the player accepts defeat or gets
victorious. And hence the game was run successfully.

27 | P a g e
REFERENCES:
 Class 11 and 12 textbook – “Computer Science with Python” by Sumita Arora.
 MJ codes – YouTube: [Link]
 NeuralNine – YouTube: [Link]

28 | P a g e

You might also like