0% found this document useful (0 votes)
5 views2 pages

Echos in The Dark

The document is a C++ program for a text-based adventure game titled *Echoes in the Dark*, where the player, Evelyn Hart, explores an abandoned asylum. The player must make choices to navigate through the asylum, solve puzzles, and collect items to survive against supernatural threats. The game concludes with different outcomes based on the player's success in solving puzzles and completing rituals.

Uploaded by

adeshparve409
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Echos in The Dark

The document is a C++ program for a text-based adventure game titled *Echoes in the Dark*, where the player, Evelyn Hart, explores an abandoned asylum. The player must make choices to navigate through the asylum, solve puzzles, and collect items to survive against supernatural threats. The game concludes with different outcomes based on the player's success in solving puzzles and completing rituals.

Uploaded by

adeshparve409
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <iostream>

#include <string>
#include <cstdlib>
#include <ctime>

using namespace std;

// Function declarations
void intro();
void explore();
void infirmary();
void basement();
void ending(bool survived);

int main() {
srand(static_cast<unsigned int>(time(0))); // Seed for randomness
intro();
explore();
return 0;
}

// Function definitions
void intro() {
cout << "Welcome to *Echoes in the Dark*.\n";
cout << "You are Evelyn Hart, a paranormal investigator, exploring an abandoned
asylum.\n";
cout << "Your goal is to uncover the asylum's secrets and survive the night.\n\
n";
cout << "A storm rages outside as you approach the asylum...\n";
cout << "Press ENTER to continue...\n";
cin.ignore();
}

void explore() {
string choice;

cout << "\nYou enter the dark asylum. The air is cold, and the walls echo with
faint whispers.\n";
cout << "Where would you like to go?\n";
cout << "1. Infirmary\n";
cout << "2. Basement\n";
cout << "Enter your choice: ";
cin >> choice;

if (choice == "1") {
infirmary();
} else if (choice == "2") {
basement();
} else {
cout << "\nInvalid choice. The asylum grows darker...\n";
explore();
}
}

void infirmary() {
cout << "\nYou enter the infirmary. The room is filled with overturned
furniture and broken equipment.\n";
cout << "A wheelchair moves on its own across the room...\n";
cout << "Suddenly, the door slams shut!\n";
cout << "Solve this puzzle to unlock the door:\n";
cout << "What is 6 + 9? ";
int answer;
cin >> answer;

if (answer == 15) {
cout << "\nThe door unlocks, and you escape the infirmary.\n";
explore();
} else {
cout << "\nYou failed to solve the puzzle. A ghostly figure emerges from
the shadows...\n";
cout << "GAME OVER. The asylum has claimed you.\n";
exit(0);
}
}

void basement() {
cout << "\nYou descend into the basement. It's pitch dark, and the air smells
of decay.\n";
cout << "You find a ritual circle and realize the spirits are trapped here.\n";
cout << "You must collect three ritual items to banish the spirits.\n";

int items = 0;
while (items < 3) {
cout << "\nYou search the room...\n";
if (rand() % 2 == 0) {
cout << "You found a ritual item!\n";
items++;
} else {
cout << "A ghost appears and whispers, 'You shouldn't be here.'\n";
}
}

cout << "\nYou have all the ritual items! Performing the ritual...\n";
cout << "Solve this final puzzle: What is 12 * 3? ";
int answer;
cin >> answer;

if (answer == 36) {
ending(true);
} else {
ending(false);
}
}

void ending(bool survived) {


if (survived) {
cout << "\nThe ritual is complete. The spirits are freed, and the asylum
collapses behind you as you escape.\n";
cout << "Congratulations! You survived.\n";
} else {
cout << "\nYou failed to complete the ritual. The spirits overwhelm you,
and you become one of them.\n";
cout << "GAME OVER. The asylum has claimed you.\n";
}
exit(0);
}

You might also like