-
Notifications
You must be signed in to change notification settings - Fork 1
/
text-based-game-brian-ryan-diem.rb
701 lines (435 loc) · 14.7 KB
/
text-based-game-brian-ryan-diem.rb
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
696
697
698
699
700
701
$image = './ascii/smiley.txt'
$name = 'buddy'
def render_ascii_art filename
File.readlines(filename) do |line|
puts line
end
end
def start
puts render_ascii_art './ascii/learn.txt'
"
You just woke up for your BIG day. After three long, hard months of study at LEARN Academy, you are now ready to interview for your internship!".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
sleep_module
end
def sleep_module
puts "
Did you get a good night's rest?
a. Yes
b. No
Enter your choice: a or b?
"
user_choice = gets.chomp.downcase
puts `clear`
if user_choice == 'b'
"Oh no, that's terrible!".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
puts "
What kept you up?
a. Counting sheep. I think I messed up my while loop.
b. The narrator of a text-based game repeatedly asking me questions.
"
user_choice = gets.chomp.downcase
puts `clear`
if user_choice == "flies"
$image = './ascii/david.txt'
$name = 'David'
"It's all right. You are emboldened by your thoughts of future six dollar pizza and cs those flies like the Challenger you are. You go to your computer... ".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
interview_module
elsif user_choice == "ghost dog"
$image = './ascii/rachael.txt'
$name = 'Rachael'
"Cool.".each_char do |value|
putc value
sleep 0.01
end
sleep 3
puts"
"
"You're ready. You drink your morning coffee, holster your sonic screwdriver, deadlift your couch, and then move over to your computer...".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
interview_module
elsif user_choice == "a"
"You were expecting an infinite loop joke here, weren't you? Nope. Not on my watch...".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
clothes_module
elsif user_choice == "b"
"Rude.".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
clothes_module
else
"I'm sorry, let's start over.".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
sleep_module
end
elsif user_choice == 'a'
"Two REM cycles? Awesome!".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
clothes_module
else
"I'm sorry, let's start over.".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
sleep_module
end
end
def clothes_module
puts "
Let's get you dressed!
What's your style for the day?
a. Casual
b. Business Casual
c. Business Formal
Enter your choice: a, b, or c?
"
user_choice = gets.chomp.downcase
puts `clear`
if user_choice == 'a'
"Okay, if you're sure... (Somewhere a single tear rolls down Bryan's face.)".each_char do |value|
putc value
sleep 0.01
end
puts ""
sleep 0.75
drink_module
elsif user_choice == 'b'
"Riding that line just right!".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
puts "
Do you want to wear glasses for the first time?
a. Yes
b. No
Enter your choice: a or b?
"
user_choice = gets.chomp.downcase
puts `clear`
if user_choice == 'a'
$image = './ascii/bach.txt'
$name = 'Bach'
"Tired? Nah. You've been up since 6am. You don't drink coffee. Coffee drinks YOU. You bump into your chair and this time you don't even apologize to it. A single nod to Lily, then you go to your computer...".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
interview_module
else
"Roger that!".each_char do |value|
putc value
sleep 0.01
end
puts ""
sleep 0.75
drink_module
end
elsif user_choice == 'c'
"Check the reflection:".each_char do |value|
putc value
sleep 0.01
end
sleep(1)
puts "
Noice."
sleep(1.25)
puts "
Very noice."
sleep(1.25)
drink_module
elsif user_choice == 'jedi'
$image = './ascii/ryan.txt'
$name = 'Ryan'
"You don your black hoodie. The Force surges through you, so strong that your internet connection momentarily fades. You look in on your young Padawan, then go to your computer to triumph in your next battle...".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
interview_module
else
"I'm sorry, let's start over.".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
clothes_module
end
end
def drink_module
puts "
Let's get your morning drink!
Coffee or tea?
a. Coffee
b. Tea
Enter your choice: a or b?
"
user_choice = gets.chomp.downcase
puts `clear`
if user_choice == 'a'
"YOWZA! That's a jolt!".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
puts"
Does it make you want to do anything special?
a. Sing!
b. Poop. Definitely poop.
c. Wait... what?
Enter your choice: a, b, or c?
"
user_choice = gets.chomp.downcase
puts `clear`
if user_choice == 'a'
$image = './ascii/joel.txt'
$name = 'Joel'
"You're not an American Idiot. You're All Work and No Play, MmHmm. Gun-Duck enthusiast. Master of Zoom. You put on your Black belt in Jiu Jitcssu, then turn to your computer...".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
interview_module
elsif user_choice == 'b'
$image = './ascii/diem.txt'
$name = 'Diem'
"Um, okay. So that happens. You then turn to your army of plushies. They have taught you organization. Relentless positivity. And the importance of an arsenal. An arsenal of emojis. You salute them, then go to your computer...".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
interview_module
elsif user_choice == 'c'
"Don't worry about it.".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
puts "
Did you make it in your own espresso machine?
a. Yes
b. No
Enter your choice: a or b?
"
user_choice = gets.chomp.downcase
puts `clear`
if user_choice == "a"
$image = './ascii/chuck.txt'
$name = 'Chuck'
"You inhale the caffeinated haze. Your mind drifts. You are in the sea. Alone. With a board. And a wave. And the pure joy of knowing that - this year at least - the Padres are not garbage. You return emboldened! You walk to your computer...".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
interview_module
elsif user_choice == "b"
"Relatable.".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
desk_module
else
"I'm sorry, let's start over.
".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
drink_module
end
else
"I'm sorry, let's start over.
".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
drink_module
end
elsif user_choice == "b"
"Mmm-mmm, that leaf water sure does go down smooth...".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
puts "
It's almost time! How do you feel?
a. Confident! I think I might want to prepare other people for this very moment someday!
b. Confident! It's just like an audition for a role!
c. I have forgotten literally everything I've ever learned.
Enter your choice: a, b, or c?
"
user_choice = gets.chomp.downcase
puts `clear`
if user_choice == 'a'
$image = './ascii/sarah.txt'
$name = 'Sarah'
"You're ready. But your interviewer doesn't know about the deal you made with LEARN. They said you could come to LEARN. They DIDN'T say you could ever leave... MUA-HAH-HAH! MUA-HAH-HAH-HAH! MUA-HA - oh, your computer turns on by itself...".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
interview_module
elsif user_choice == 'b'
$image = './ascii/drew.txt'
$name = 'Drew'
'You center yourself. You say "red leather, yellow leather" 37 times. Of course, you must roll a d20 for your Performance check. You crit. You always crit. You sit at your computer...'.each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
interview_module
elsif user_choice == 'c'
"Meh, I'm sure it'll be fine.".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
interview_module
else
"I'm sorry, let's start over.
".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
drink_module
end
elsif user_choice == "water"
$image = './ascii/brian.txt'
$name = 'Brian'
"How... hydrating. Okay, look. I'm getting kind of creeped out over having to simultaneously narrate in the first and second persons. How about you just go over to your computer and we can all move on...".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
interview_module
elsif user_choice == "pumpkin pie"
$image = './ascii/andee.txt'
$name = 'Andee'
"That's not even a beverage. But don't let that distract you from the fact that you now step into your TARDIS to go back to 1998 and throw Mankind off Hell in a Cell, and plummet 16 ft through an announcer's table. Which is also a TARDIS. So now you're back and can stand at your computer...".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
interview_module
else
"I'm sorry, let's start over.
".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
drink_module
end
end
def desk_module
puts "
Let's go to your desk!
Two quick questions:
Do you need to move it?
And is it in a tree?
a. I need to move it.
b. It's in a tree.
c. Okay, I can understand needing to move it. But why would it be in a tree?
Enter your choice: a, b, or c?
"
user_choice = gets.chomp.downcase
puts `clear`
if user_choice == 'a'
$image = './ascii/nate.txt'
$name = 'Nate'
"You channel the power of an Idaho Caribou to muscle your desk across the entire house. You see the sun through the window. It's strange to see it when you're awake, but you think you will come to be good friends. You turn on your computer... ".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
interview_module
elsif user_choice == 'b'
$image = './ascii/matt.txt'
$name = 'Matt'
"Before going outside, you pause to get into character. Today YOU are the hero. But you are not Captain America. You are not Master Chief. Today you are NEO. And THERE WILL BE NO SPOON. You begin to climb...".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
interview_module
elsif user_choice == 'c'
"Some questions have no answer.".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
puts "
Let's go to the interview!"
interview_module
else
"I'm sorry, let's start over.
".each_char do |value|
putc value
sleep 0.01
end
sleep 0.75
desk_module
end
end
def interview_module
sleep 0.5
puts"
Now's the time!
Press RETURN to open zoom and turn on your video!"
gets
puts `clear`
puts render_ascii_art $image
sleep 1.5
puts "
Looking GOOD, #{$name}!"
sleep 1.5
puts "
You're going to nail this!
"
sleep 1.75
" DELTA!, DELTA!, DELTA!".split(',').each do |word|
print word
sleep 1.1
end
sleep 0.75
print "
LET'S "
sleep 1
"GOOOOOOOOOOOOOOOOOOOOOOO!!!!!".each_char do |value|
putc value
sleep 0.065
end
sleep 1
puts "
"
end
start