-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
695 lines (591 loc) · 23.6 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
#include <iostream>
#include <string>
#include <cctype>
#include <fstream>
using namespace std;
string garbage;
const string artDoor = " ┌─────┐\n | |\n | x|\n | |\n───└─────┘───";
const string artBestClock = " _______\n / 12 \\\n| | |\n|9 |/ 3|\n| * |\n| |\n \\___6___/";
const string artWall =
"┌─────────────────────────────┐\n"
"| ┌──┐ 🕐 ┌─────┐ |\n"
"| └──┘ | | |\n"
"| _____ | x| |\n"
"| |__o__| | | |\n"
"└──────└─────┘──────└─────┘───┘";
const string artFloor =
"┌─────────────────────────────────────────────────┐\n"
"| __ ________________ |\n"
"| .''..''. | | ##### | #### |\n"
"| :._.''._.: | |_##### |_#####___ |\n"
"| : \\__/ : |_ ___ ___ |_\\ |\n"
"| './ \\.' |_|__/ \\___/ \\____| |\n"
"| '' \\___/ \\___/ |\n"
"| |\n"
"| |\n"
"| ┌───────────┐ _ |\n"
"| | _ | _ | _ | /_\\ |\n"
"| | _ | _ | _ | |___| |\n"
"| | _ | _ | _ | | | |\n"
"| └───────────┘ |_| |\n"
"| ┌───────────┐ / \\ |\n"
"| | O | _ | O | | | |\n"
"| | X | _ | X | | | |\n"
"| | X | X | X | |___| |\n"
"| └───────────┘ |\n"
"└─────────────────────────────────────────────────┘\n";
const string artDresser = " _______\n|_o_|_o_|\n|___o___|\n|___o___|\n|___o___|\n|| ||";
const string artOldRoomFloor = "┌─────────────────────────────────────────────────┐\n| ________ _______________ |\n| |__|__|__| | | ##### | #### |\n| |__|__|__| | |_##### |_#####___ | \n| |__|__|__| | _ ___ ___ |_ |\n| | _|/ \\___/ \\____| |\n| \\___/ \\___/ |\n| |\n| |\n| ┌───────────┐ |\n| | _ | _ | _ | |\n| | _ | _ | _ | |\n| | _ | _ | _ | |\n| └───────────┘ |\n| ┌───────────┐ |\n| | _ | _ | X | |\n| | O | _ | _ | |\n| | _ | _ | _ | |\n| └───────────┘ |\n└─────────────────────────────────────────────────┘";
const string artThreeDoors = " ┌─────┐ ┌─────┐ ┌─────┐ \n | 1 | | 2 | | 3 |\n | x| | x| | x|\n | | | | | |\n───└─────┘───└─────┘───└─────┘───";
const string artPainting = "╬════════════════╬\n║──────────░░░░░░║\n║──────────░░░░░░║\n║─▐▀▀█─────░░░░░░║\n║─▐▄─▄▌──▄─▄─────║\n║──▐▐────│─┼─────║\n║████████████████║\n╬════════════════╬";
const string artPaintingCompleted = "╬════════════════╬\n║──────────░xxxx░\n║\n║──────────░x░░x░║\n║─▐▀▀█─────░xxxx░║\n║─▐▄─▄▌──▄─▄─────║\n║──▐▐────│─┼─────║\n║████████████████║\n╬════════════════╬";
const string artFuneral =
" -|-"
" |"
" .-'~~~`-."
" .' `. RIP..."
" | __ |"
" | | | | 0"
" | | x| | ██ /|\\"
" \\\\| | | |// ██ / \\"
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^";
const string artFuneralEnd =
" -|-"
" |"
" .-'~~~`-."
" .' `. END..."
" | __ |"
" | | | | 0"
" | | x| | ██ /|\\"
" \\\\| | | |// ██ / \\"
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^";
const string artSoccer =
" __\n"
" .'\".'\"'.\n"
":._.""._.:\n"
": \\__/ :\n"
" './ \\.'\n"
" \"\"\n";
const string artToyCar =
" ________________\n"
"| | ##### | ####\n"
"| |_##### |_#####___\n"
"|_ ___ ___ |_\\\n"
"|_|__/ \\___/ \\____|\n"
" \\___/ \\___/ \n";
const string artBetterClock =
" _______\n"
" / 3 \\\n"
"| | |\n"
"|6 |/ 12\n"
"| * |\n"
"| |\n"
" \\___9___/\n";
const string artWorstClock =
" _______\n"
" / Ii5 \\\n"
"| | |\n"
"|6P |/ E|\n"
"| * |\n"
"| |\n"
" \\___G___/\n";
const string riddle = "There is one thing that goes around the house and also inside the house but it never touches anything. What is it?";
string sisterName;
string promptUser(string prompt) {
string userInput;
cout << prompt + "\n> ";
cin >> userInput;
return userInput;
}
void clearScreen() {
cout << "\x1B[2J\x1B[H";
}
void enterToContinue(string s) {
cout << s;
cin.ignore();
clearScreen();
}
void enterToContinue(string s, bool clear) {
cout << s;
cin.ignore();
if (clear) {
clearScreen();
}
}
void renderArt(int artName) {
switch (artName) {
// Display the door
case 0:
cout << artDoor;
break;
// Display the best clock
case 1:
cout << artBestClock;
break;
// Display the wall item
case 2:
cout << artWall;
break;
// Display the floor
case 3:
cout << artFloor;
break;
// Display the dresser
case 4:
cout << artDresser;
break;
// Display the old room's floor
case 5:
cout << artOldRoomFloor;
break;
// Display the three doors
case 6:
cout << artThreeDoors;
break;
// Display the painting
case 7:
cout << artPainting;
break;
// Display the completed painting
case 8:
cout << artPaintingCompleted;
break;
// Display the funeral
case 9:
cout << artFuneral;
break;
// Display the soccer ball
case 10:
cout << artSoccer;
break;
// Display the toy car
case 11:
cout << artToyCar;
break;
// Display the better clock
case 12:
cout << artBetterClock;
break;
// Display the worst clock
case 13:
cout << artWorstClock;
break;
// Display the end funeral
case 14:
cout << artFuneralEnd;
break;
default:
break;
}
cout << "\n";
}
void introduction() {
sisterName = promptUser("Enter a tragic sister name: ");
enterToContinue("You wake up..");
enterToContinue("You're lying down.");
enterToContinue("You must be.. lying down in your cozy bed.. yes, you're in your room and.. that stomping?");
enterToContinue("It's your sister!");
enterToContinue("It's " + sisterName + ", yes! And she's bringing breakfast! The most beautiful breakfast you've ever seen!");
enterToContinue("You can almost taste it");
enterToContinue("It smells like, it smells like... what does it smell like?");
enterToContinue("Oh well...");
enterToContinue("It's a beautiful day, and you feel the sun beaming down on your skin");
enterToContinue("You feel that.. you feel the feeling that sun makes when it beams down on your skin. Whatever it is, you feel it. You do.");
enterToContinue("Yes! And your sister, " + sisterName + ", is here with you. Just like the good old times!");
enterToContinue("...");
enterToContinue("*sobbing*");
enterToContinue("...");
enterToContinue("--Good old times?");
enterToContinue("What good old times?");
enterToContinue("New times are good too! All times are great, including this one!");
enterToContinue("Indeed, this is the best time ever, right now.");
enterToContinue("Right here, in my bed, in my cozy bed, with " + sisterName + " right here..");
enterToContinue("--Wait--");
enterToContinue("What time is it again?");
enterToContinue("<You look down at your watch.>");
renderArt(1);
cout << "It is 1 o'clock" << endl;
cin.ignore();
enterToContinue("Surely--");
enterToContinue("She's probably downstairs, that's all.");
enterToContinue("Breakfast is taking a little longer than expected, that's all.");
enterToContinue("You're in your room, and you're waiting for " + sisterName + " to finish making breakfast, that's all.");
enterToContinue("THAT.");
enterToContinue("IS.");
enterToContinue("ALL.");
enterToContinue("...");
}
bool isInt(string s) {
bool ret = true;
for (char c : s) {
if (
c != '0' &&
c != '1' &&
c != '2' &&
c != '3' &&
c != '4' &&
c != '5' &&
c != '6' &&
c != '7' &&
c != '8' &&
c != '9'
) ret = false;
}
return ret;
}
// Tic-Tac-Toe
bool ticTacToe() {
string b[9][2];
const string x0 = " \\/ ";
const string x1 = " /\\ ";
const string o0 = " _ ";
const string o1 = "|_| ";
const string blank = " ";
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 2; j++) b[i][j] = blank;
}
clearScreen();
cin.ignore();
enterToContinue("You can't use the O's. You just can't. They were--");
enterToContinue("They are--");
enterToContinue("For " + sisterName + ".");
bool completed = false;
string ans;
while (true) {
do {
ans = promptUser("\n\nYour move (1-9) or stop playing (s): ");
} while (
ans.length() != 1 &&
ans[0] != '1' &&
ans[0] != '2' &&
ans[0] != '3' &&
ans[0] != '4' &&
ans[0] != '5' &&
ans[0] != '6' &&
ans[0] != '7' &&
ans[0] != '8' &&
ans[0] != '9' &&
ans[0] != 's');
if (ans[0] == 's') {
if (b[4][0] == x0) //completed = true;
break;
}
int num = ans[0] - '1';
b[num][0] = x0;
b[num][1] = x1;
clearScreen();
cout <<
" __________________________\n"
"|1 " + b[0][0] + " |2 " + b[1][0] + " |3 " + b[2][0] + " |\n"
"| " + b[0][1] + " | " + b[1][1] + " | " + b[2][1] + " |\n"
"|________|________|________|\n"
"|4 " + b[3][0] + " |5 " + b[4][0] + " |6 " + b[5][0] + " |\n"
"| " + b[3][1] + " | " + b[4][1] + " | " + b[5][1] + " |\n"
"|________|________|________|\n"
"|7 " + b[6][0] + " |8 " + b[7][0] + " |9 " + b[8][0] + " |\n"
"| " + b[6][1] + " | " + b[7][1] + " | " + b[8][1] + " |\n"
"|________|________|________|";
}
//if (!completed) return false;
renderArt(8);
enterToContinue("Wait--");
enterToContinue("This looks interesting..");
enterToContinue("Indeed, it looks like it would fit quite nicely in the painting.");
return true;
}
void context();
void escapeRoom() {
bool painting = false;
bool escape = false;
bool completed = false;
string userInput = "y";
if (userInput == "y") {
clearScreen();
while (!escape) {
// Display wall
clearScreen();
renderArt(2);
do {
userInput = promptUser("Which item do you want to inspect? Enter a number. \n\t1. Clock\n\t2. Floor\n\t3. Door\n\t4. Dresser\n\t5. Painting");
} while (userInput != "1" && userInput != "2" && userInput != "3" && userInput != "4" && userInput != "5");
clearScreen();
if (userInput == "1") {
renderArt(13);
cout << "\nWhy is the time all messed up?\n";
cin.ignore();
} else if (userInput == "2") {
renderArt(3);
string toyInspect;
do {
toyInspect = promptUser("Which toy do you want to inspect? Enter a number. \n\t1. Soccer ball\n\t2. Toy car\n\t3. Tic-Tac-Toe (top)\n\t4. Tic-Tac-Toe (bottom)\n\t5. Rocket");
} while (toyInspect != "1" && toyInspect != "2" && toyInspect != "3" && toyInspect != "4" && toyInspect != "5");
if (toyInspect == "1") {
clearScreen();
renderArt(10);
cout << "You've never liked soccer. But right now, you want to play. You want to play with " << sisterName << ". Maybe after breakfast.";
} else if (toyInspect == "2") {
clearScreen();
renderArt(11);
cout << "You got this toy car for christmas and " << sisterName << " always played with it instead of you.\n";
cout << "You remember getting into many arguments because it was YOUR toy, but now you wish that you let her play with it more..";
} else if (toyInspect == "3") {
completed = ticTacToe();
} else if (toyInspect == "4") {
enterToContinue("It was no use trying to teach " + sisterName + " tic-tac-toe. She just drew pictures on the board anyways.");
} else if (toyInspect == "5") {
enterToContinue("You were going to go to the moon with " + sisterName + ".");
enterToContinue("--What?");
enterToContinue("You still are. Indeed, you'll go tommorow. No, today. After breakfast. You and " + sisterName);
}
enterToContinue("", false);
cin.ignore();
} else if (userInput == "3") {
renderArt(0);
if (painting || completed) {
cout << "\nOkay. Now you'll go down to breakfast.";
cin.ignore();
context();
} else {
cout << "\nThe room pulls you in. Something feels incomplete..";
cin.ignore();
}
} else if (userInput == "4") {
renderArt(4);
cout << "\nIt's.. empty. You've got to get " << sisterName << "'s stuff in here.";
cin.ignore();
}
else if (userInput == "5"){
renderArt(7);
if (completed && "y") {
do {
userInput = promptUser("Place Tic-Tac-Toe board in painting? (y/n)");
} while (userInput != "y" && userInput != "n");
if (userInput == "n") {
cin.ignore();
enterToContinue("Okay, you'll just stay here forever. With " + sisterName + " just downstairs.");
while (true) enterToContinue("With " + sisterName + " just downstairs.");
}
else if (!completed && "y"){
enterToContinue("It looks good now. It's complete.");
painting = true;
}
}
enterToContinue("Was that-");
enterToContinue("Your sister's painting?");
enterToContinue("Why is it incomplete?");
do {
userInput = promptUser("Would you like to start the painting riddle? (y/n)");
} while (userInput != "y" && userInput != "n");
if (userInput == "y"){
clearScreen();
// Show painting
renderArt(7);
userInput = promptUser(riddle);
for (char &c : userInput) c = tolower(c);
while (userInput != "sun") {
do {
userInput = promptUser("Good try. Try Again (y/n)?");
} while (userInput != "y" && userInput != "n");
if (userInput == "y") {
clearScreen();
renderArt(7);
userInput = promptUser(riddle);
for (char &c : userInput) c = tolower(c);
}
else break;
}
if (userInput == "sun") {
clearScreen();
cin.ignore();
enterToContinue("Oh right-");
enterToContinue("You were supposed to complete it with " + sisterName + ". Together.");
enterToContinue("It needs to be completed. That's all. She'll come back after you complete it. Surely.");
}
}
}
cin.ignore();
}
cout << "...great job.\n";
return;
}
}
void leavingRoom() {
enterToContinue("OK, let's get out of this room...");
enterToContinue("(You look for the door...)");
enterToContinue("(There are three doors");
}
// Nobody touch this! It is delicate!
void threeDoors() {
int seg = 0;
string ans;
while (ans != "b" || seg != -1) {
string one = to_string(seg * 3 + 1);
string two = to_string(seg * 3 + 2);
string three = to_string(seg * 3 + 3);
string a[3][3];
for (int i = 0; i < 3; i++) {
string nstr = to_string(seg * 3 + 1 + i);
if (nstr.length() == 1) {
a[i][0] = " ";
a[i][1] = " ";
a[i][2] = nstr[0];
}
else if (nstr.length() == 2) {
a[i][0] = " ";
a[i][1] = nstr[0];
a[i][2] = nstr[1];
}
else {
a[i][0] = nstr[0];
a[i][1] = nstr[1];
a[i][2] = nstr[2];
}
}
clearScreen();
cout <<
" ┌─────┐ ┌─────┐ ┌─────┐\n"
" | " + a[0][0] + a[0][1] + a[0][2] + " | | " + a[1][0] + a[1][1] + a[1][2] + " | | " + a[2][0] + a[2][1] + a[2][2] + " |\n"
"<--back(b) | x| | x| | x| next(n)-->\n"
" | | | | | |\n"
"────────────└─────┘───└─────┘───└─────┘────────────\n";
if (seg != 33) {
cin >> ans;
if (tolower(ans[0]) == 'n') seg++;
else if (tolower(ans[0]) == 'b') seg--;
else if (isInt(ans)) {
int ansI = 0;
for (char c : ans) {
ansI *= 10;
ansI += c - '0';
}
clearScreen();
cin.ignore();
if (ansI < seg * 3 + 1 || ansI > seg * 3 + 3) {
cout << "Hmm.. where is that room?" << endl;
cin.ignore();
}
else {
cout << "Room " + ans + " is empty. " + sisterName + " must be in the next room. She has to be." << endl;
cin.ignore();
}
}
} else {
cin.ignore();
enterToContinue("You'll never find your sister. Not even in all the infinite rooms of this hallway.");
break;
}
}
}
void context() {
enterToContinue("I thought I escaped..");
enterToContinue("What time is it?");
enterToContinue("<You look at the clock>");
renderArt(12);
enterToContinue("...");
threeDoors();
}
void ending() {
enterToContinue("FINALLY");
enterToContinue("WHERE IS SHE??");
enterToContinue("She has to be here somewhere...");
enterToContinue("[ Go to Door 100 ]");
enterToContinue("What time is it?");
renderArt(1);
cout << "It is 1 o'clock.";
enterToContinue("...");
enterToContinue("*sobbing*");
threeDoors();
renderArt(14);
}
int main() {
introduction();
escapeRoom();
context();
ending();
return 0;
}
/*
What if:
- Trapped in a jungle, complete adventure to get out
- Riddles (with graphics and simple animations)
- Escape room
- Drone 0679:
- You wake up on a hard, cold, floor. Your muscles are sore and can't feel anything from the neck up. Somehow, your eyes blink open.
- IMAGE OF ROBOT
Hello. I am 0670. Please accept my challenge.
- Accept / Decline.
Great
Setup:
- start with an animation
Hey.. there isn't any time for that right now..
Drone 0679 -
Graphics/Animations:
- Introduction
- Trees?
- Blurred trees? (to symbolize running)
Games:
- [x] Tic-Tac-Toe
- [ ] 3 doors
-
Stoescape roomry:
Why did the sister die
- Character finds out after challenges and is able to move on from death
Escape room:
use key and code to escape
- Clock
- time of death
- 1 = code for door to escape
- Floor
- loose floorboard
- need a tool to look under floor
- if you have the tool, discover key to door
- Drawers
- look in the drawers to get tool
- Painting
- Was created by sister (character reflects and is helped with moving on)
---
introduction():
enterToContinue("You wake up..");
enterToContinue("You're lying down.");
enterToContinue("You must be.. lying down in your cozy bed.. yes, you're in your room and.. that stomping?");
enterToContinue("It's your sister!");
enterToContinue("It's " + sisterName + ", yes! She's bringing breakfast! The most beautiful breakfast you've ever seen!");
enterToContinue("You can almost see it..");
enterToContinue("It smells like... the most wonderful thing you've ever smelled!");
enterToContinue("You can almost smell it, wafting up through the stairs..");
enterToContinue("It's the most wonderful morning you've ever lived!");
enterToContinue("You can almost feel it..");
enterToContinue("You're almost alive.");
enterToContinue("Yes! And " + sisterName + " is here with you. Just like the good old times!");
enterToContinue("...");
enterToContinue("*sobbing*");
enterToContinue("...");
enterToContinue("--Good old times?");
enterToContinue("What good old times?");
enterToContinue("New times are good too! All times are great, including this one!");
enterToContinue("Indeed, this is the best time ever, right now.");
enterToContinue("Right here, in my bed, in my cozy bed, with " + sisterName + "right here..");
enterToContinue("--Wait--");
enterToContinue("Where is she?");
enterToContinue("Surely--");
enterToContinue("Surely--");
enterToContinue("Surely!--");
enterToContinue("She's fine,");
enterToContinue("Surely, she's fine, right?");
enterToContinue("She's fine!");
enterToContinue("SHE'S FINE GODDAMIT");
enterToContinue("SHE'S THE MOST FINE I'VE EVER FUCKING SEEN");
enterToContinue("She's fine.");;
enterToContinue("She's still downstairs, that's all.");
enterToContinue("Breakfast is taking a little longer than expected, that's all.");
enterToContinue("It's those new eggs, that's all");
enterToContinue("That's all it is, silly me! It's those new eggs. Yes, those new eggs take longer to cook. I'll never buy them again. I'll make sure of it.");
enterToContinue("I'm in my room, and I'm waiting for her to finish cooking breakfast, that's all. THAT. IS. ALL.");
enterToContinue("Surely, surely, surely..");
enterToContinue("Oh, you went downstairs to take out the trash! come on, just come back for a second, " + sisterName + ".");
enterToContinue("Come back for a second please. I know breakfast is taking a little longer to make than expected! It's those ");
*/
// tic tac toe, 3 doors, and
// enterToContinue("-- STOP. STOP! Don't do this to yourself again. You know where you really are. Just accept it.");
// Play a game with sister
// enterToContinue("You begin running away and you suddenly find yourself in a jungle. Now you're lost and you need to find a way to escape.");ticTac