This repository has been archived by the owner on Mar 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
enlighten.rb
354 lines (311 loc) · 8.23 KB
/
enlighten.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
module Enlightenment
$inventory = []
$death_count = 0
$run = 0
$miss = 0
# this method is for displaying the final stats in the game
def stats
if $death_count == 0
print "You've never died. "
elsif $death_count > 1
print "You've died #{$death_count} times. "
elsif $death_count < 0
print "Your non-death might awaken something. "
else
print "You've died #{$death_count} time. "
end
if $inventory.empty?
print "You have no items.\n"
puts "Care to try again?"
else
print "You've collected:\n"
puts $inventory
puts
puts "Care to try again?"
end
end
# method for displaying options to user
def display_choices
puts <<-END
What do you want to do?
Options: #{yield}
END
end
# method for introducing the game
def intro_game
puts <<-END
You awaken in a bright room full of fog and
as your eyes adjust, the fog lifts and you find yourself
wanting more from life.
END
if $run == 1
sleep(2)
puts "Did you really think this was the end?"
sleep(2)
elsif $run == 2
sleep(2)
puts "You're not asleep and you're not awake."
sleep(2)
end
display_choices {"(G)o through the door, (S)tay put, (I)nner journey"}
$run += 1
end
# method for the mid point
def end_game
puts <<-END
You awaken in a bright room full of fog and
as your eyes adjust, the fog lifts and you find yourself
at a fork in the road.
END
display_choices {"(M)editate, (C)ontemplate, (I)ntrospect"}
end
# the ask_player methods will present a series of situations for the player
# to deal with. past answers will affect the later methods. I hope.
def ask_player
case gets.chomp.upcase
when "G"
puts <<-END
You step through the door, go about your life as usual with
a nagging feeling in the back of your mind that there was something
you wanted but can no longer remember. Finally, at your death bed,
you remember. But by then...
END
sleep(2)
$death_count += 1
when "S"
puts <<-END
You decide staying in the room is much better than leaving the room.
But you quickly get bored and go through the door. Life happens. Then
you die.
END
sleep(2)
$death_count += 1
when "I"
puts <<-END
You close your eyes and focus on your breath.
As you breathe in...and out.... you travel to the planes
of the inner mind.
END
sleep(2)
else
puts <<-END
You die from incompetence.
END
sleep(2)
$miss += 1
$death_count += 1
end
end
def ask_player2
case gets.chomp.upcase
when "G"
puts <<-END
You feel as if you have done this before but shake the feeling away
as a simple case of deja vu. You face life just like you always have
perhaps achieve a modicum of fame and fortune, but in the end,
it didn't matter.
END
sleep(2)
$death_count += 1
when "S" #branch within a branch!
puts <<-END
Staying in the room isn't so bad, after all,
you were in here for a reason.
You notice a shiny object in the corner and bend over to inspect it.
END
sleep(2)
display_choices {"(P)ick object up, (L)eave it be"}
case gets.chomp.upcase
when "P"
puts <<-END
You decide to pick it up. It appears to be a ring.
END
sleep(2)
$inventory.push("ring")
when "L"
puts <<-END
You don't want to mess with anything,
you realize nothing in the room looks familiar. Where are you?
END
$inventory.push("map")
sleep(2)
else
puts <<-END
You've done it again. You die TWICE for your silliness.
END
sleep(2)
$miss += 1
$death_count += 2
end
when "I"
puts <<-END
You open your eyes and wonder if what you are seeing is real. You also
can't seem to tell if you've ever died or not. Perhaps it's time to
go through the door.
END
sleep(2)
$death_count = -1
else
if $miss > 0
puts <<-END
Surprisingly, you don't die. Instead, you get a skunk.
END
sleep(2)
$inventory.push("skunk")
else
puts "You die a million deaths."
sleep(2)
$death_count += 1_000_000
end
end
end
def ask_player3
case gets.chomp.upcase
when "42"
puts "You found the meaning of life!"
sleep(2)
$inventory.push("Hitchhiker's Guide")
else
puts "At this point in your life, does the choice really matter?"
puts
sleep(2)
end
end
def ask_player4
if $death_count >= 3
case gets.chomp.upcase
when "M"
puts <<-END
You attempt to quiet your mind but it zips all over.
END
when "C"
puts <<-END
Perhaps you should avoid dying so often.
END
when "I"
puts <<-END
You realize death has no meaning.
END
else
puts <<-END
THIS IS JUST A GAME.
END
end
elsif $inventory.include?("Hitchhiker's Guide")
case gets.chomp.upcase
when "ZAPHOD"
puts "Stop being so sneaky with the easter eggs!"
else
puts "Well you're just a little sneak aren't you?"
end
elsif $inventory.include? "ring"
case gets.chomp.upcase
when "M"
puts <<-END
Your thoughts go to the ring you found previously, in, what?
another life? another timeline? Perhaps if we went deeper,
we'd find out more...
END
when "C"
puts <<-END
You think deeply about your options and realize they all mean the same
thing. Maybe this is a clue to the correct path?
END
when "I"
puts <<-END
You may find this ending unsatisfying, but the simplest truths usually
are.
END
else
puts "Maybe your choice is better, maybe not."
end
elsif $inventory.include? "map"
case gets.chomp.upcase
when "M"
puts <<-END
You fish around your pockets and find a map. A map to the mind!
Where shall you explore first? Traverse the plains of hilarity
or will you speak to the other beings the dwell, hidden from view?
Only you can decide!
END
when "C"
puts <<-END
You decide to embark on the biggest challenge of your life! This is,
unquestionably, the most difficult expedition you will embark on. The
end goal, to Be.
END
when "I"
puts <<-END
You've mapped out your life, now it's time to map out your next lives.
All it takes is a leap.
END
else
puts <<-END
A rebellious mind may work for now, but eventually you will
calm down. Wake up, now.
END
end
elsif $inventory.include? "skunk"
case gets.chomp.upcase
when "M"
puts <<-END
You have a skunk. A SKUNK! Why, why didn't you just do what was asked?
You and I know why. It's ok, though, I understand.
END
when "C"
puts <<-END
What's funny is that you kept the skunk. You smell atrocious, but you,
yeah you, don't seem to care. Which is a good start.
END
when "I"
puts <<-END
You take the skunk out of your pocket (how on earth did
it fit in there?!) and set it free. It thanks you by lifting its
tail and spraying you with a scent unmatched by any garbage dump.
But at least you didn't die.
END
else
puts <<-END
We just can't win with you, can we? You get a skunk and you still
defy us. No matter, see you in the next life.
END
end
elsif $miss > 0 and not $inventory.include? "skunk"
case gets.chomp.upcase
when "M"
puts "If you go down this path, make sure you stink."
sleep(2)
else
puts "Above all else, touch type."
sleep(2)
end
else
case gets.chomp.upcase
when "M"
puts "You entered empty handed, you leave empty handed."
when "C"
puts "Your true path begins here and now. With nothing."
when "I"
puts "A clean life, a clean path. You have always known. Keep at it."
else
puts <<-END
A mistake is all that is needed to start your quest.
You slipped and died.
END
$miss += 1
$death_count += 1
end
end
end
def main_game
intro_game
ask_player
intro_game
ask_player2
intro_game
ask_player3
end_game
ask_player4
stats
end
end