Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adventure game #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Choose Your Own Adventure

Create a [Choose Your Own Adventure](http://en.wikipedia.org/wiki/Choose_Your_Own_Adventure#Format) game. [Here](https://writer.inklestudios.com/stories/musgraveritual) is a fancy web-based example, but creating yours as text-only, command-line based is fine. You can use ASCII art if you're feeling...wait for it...*adventurous*.
This is Mirna's Choose your own adventure game.
The goal of this game is to make it through the day between studying, work, and relaxing during the final's week.

![cookie monster](http://media.giphy.com/media/5wWf7GXcEM6fJRAzUo8/giphy.gif)

See the [asciiart](https://github.com/nodanaonlyzuul/asciiart) and [artii](https://github.com/miketierney/artii) gems.

Submit a pull request to this repository with all the necessary files, and replace this README with a description of your game and how to run it. Make sure to give the user instructions in the game about how to play, get help, etc.
To play this game you need to update your fork, open command line, cd directory to that containing the final_week.rb file, and then run this file (ruby final_week.rb).
Interacting with this game requires that you type in the your choice as shown in the list that appears on every step.
To end, type in end.
43 changes: 43 additions & 0 deletions final_week.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This is the final_week adventure game.
class Adventure
attr_accessor :introd, :levels
def initialize(arr)
@introd = arr
@levels = Array.new(5) { Hash.new }
@levels[0] = { 'go out' => 1, 'study' => 2, 'relax' => 10 }
@levels[1] = { 'start over' => 0, 'proceed' => 3 }
@levels[2] = { 'work' => 4, 'study' => 5, 'nap' => 8 }
@levels[3] = { 'start over' => 0, 'union' => 6, 'nap' => 7, 'turnoff' => 9 }
@levels[4] = { 'start over' => 0 }
end

def start
puts introd[0].chomp('*')
play_game
end

def start_over
puts introd[0].chomp('*')
end

def game_loop(choice, no)
while choice != 'end'
if levels[no][choice] == 0 then no = start_over.to_i
elsif choice == 'end' then break
elsif levels[no][choice].nil?; puts 'Choice N/A.Type as shown in ()'
else
puts introd[levels[no][choice]].chomp('*')
no += 1
end
choice = gets.chomp
end
end

def play_game
no = 0
choice = gets.chomp
game_loop(choice, no)
end
end
story_game = Adventure.new(File.readlines('story.txt', '*'))
story_game.start
36 changes: 36 additions & 0 deletions story.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Tonight is Sunday night, and the easiest of your finals is tomorrow. Or so you think. The class is an Art History Class and the teacher has been generally pretty easy with his tests, though he said he'll be a little tougher on the final. You have a couple of options. Choose wisely.
1)Go Out ('go out')
2)Study ('study')
3)Just Relax all night ('relax')
NOTE: choose one by typing the words in paranthesis ("Single quotes are NOT needed).*
You decide to go out drinking. You go to Mad Jacks, and have yourself a couple of budweisers, the crappiest beer ever made. You begin worrying more and more about your finals, so you drink more and more to forget about them. Next thing you know you've drank yourself into a mad frenzy and the wife beater in you begins to emerge. You start thrashing out at anyone around you, and the next thing you know, you're on top of the tables kicking people while wearing only your skivvies for some strange reason. When you wake up the next morning in jail you only can remember something having to do with a pool stick and three chinese fans. Go figure. YOU LOSE!! TRY AGAIN!
1) Start over! ('start over')
2) END ('end')*
You decide to study. You cram every ounce of knowledge that you probably already knew down your throat. You stay up late studying, and only wind up getting about 3 hours of sleep. You wake up totally exhausted, and confused because you went over the information so much. Next thing you know, you're walking in 20 minutes late for your test, unbathed and half asleep. The teacher tells you that she's sorry, but you won't be able to take the test because you're late. Later that day you talk to people and they say that they didn't study and they aced the test. That it was the easiest test they ever took. Turns out that you were the only looser that even studied for that easy ass test! You Fail !! Maybe you can do better on the next tests... or it's not too late to start over...
1)Start over ('start over')
2)On to Monday Night... ('proceed')
3) END ('end')*
It's Monday afternoon, and your first final is finished. You have to go into work tonight, and you could use the extra cash. You also want to eat some Bamboo Palace Chinese Food! The greatest chinese food ever made (near kamms corner on Lorain Rd and Rocky River drive), of course that would mean ditching work... But what you really should be doing is studying for your next final. . But there'll be time to do that later tonight.... right? It's a History Class, encompassing the whole of the History of Russia so it's not particulary easy. You have a two or three chapters to read, but motivation is at an all time low. What do you do?
1)Go To Work ('work')
2)Get to Studying ('study')
3)How about we forget our worries and take a nice long NAP! ('nap')
4) END ('end')*
You Decide to go to work. You work at a department store for extra cash, but tonight turns out to be extremely stressful. There are customers running around complaining about everything. It's as though everyone has finals. You begin to dread having come into work for that lousy 5.25 an hour you're making, so you begin to slow down in performance. Your manager comes over and asks what's wrong, and you tell him that you have a lot of stress right now. He just bitches more and says that your attitute reflects back on the company or some crap like that. All managers say that so you just half listen. He realizes that you're not even listening and decides that you deserve to be fired right there on the spot. He sends you home after a nice long conversation, an hour past the time that you wre supposed to get off of work. You get back home, but after just losing your job you have very little motivation to get anything done. You try studying but it's useless, you're completely exhausted. You fall asleep on your book. The next day you wake up in time for your test but you're not prepared at all for it. You agonize over each problem individually and in the end put in enough BS and effort that you clear a solid D-... was it worth it? Congrats on to Tuesday afternoon... Well a D- isn't THAT bad...
1) Start over ('start over')
2) END ('end')*
You decide that it's about time you started studying. You're sitting there at your desk with your books underneath you but you just can not seem to get yourself motivated to do anything... so you sit and sit and sit... eventually you start to realize the problem! Your lazy! Oh wait... no you're hungry. You're going to have to put some food in that stomach before you do anything else. And since you're out of hard core cash that means you're going to have to go to the Union... Which is notorious for it's bad food. Of course spaghetti is on sale during finals week... Of course in the end you could also just take a nap... you won't have to worry about about being hungry anymore if you're sleeping...
1)Get up from your desk and go to the union for cheap spaghetti ('union')
2)Nappy Time! ('nap')*
Your hunger gets the best of you, so you actually decide to go to the union. Luckily, as always happens during finals week, the union is having a special of all you can eat pasta for like two bucks. Since you only have about 3 dollars on your card you figure it's a good bet, and you really fill up on those pastas. You eat and eat to your hearts content, even though you had to puke once because you ate a fingernail. You keep eating, and when finally you're done you go back to your room feeling dizzy and disoriented. You stumble into your room and decide to take a little nap. Unfortunately it's a longer nap than you ever expected. You die that night from some crappy disease caused by uncooked meat. Turns out the guys at the union forgot to cook the meat in the spaghetti sauce again. Not that that's unusual! Game over. Damn that Union Food...
1) Start over ('start over')
2) END ('end')*
You decide to just relax. You sit back, plop down in a chair, and turn on some radiohead to keep yourself moving. Later you decide to watch a movie, and you get to bed early non-the less. You wake up in time for your final the next day and you cram a little bit right before the test. 20 minutes later you're walking out of class feeling fine. The test was easier than you thought. Good Job!!
1) Start over ('start over') 2) END 'end'*
Forget your current problems! They're not important anyways! What's important is getting a good nights sleep! So you curl up at 6 o clock in the evening in your nice toasty warm bed and try to fall asleep, but the phone keeps ringing and it's keeping you awake! How will you ever get any sleep in if the phone just keeps ringing?!
1)Take the Phone off the HOOK! ('turnoff')*
You decide to take the phone off the hook to help yourself get a good nights sleep, starting at 6 p.m... with the phone off the hook there are no more disturbances and you sleep like a baby in no time. Unfortunately 4 in the morning rolls around and you find yourself wide awake staring at the ceiling, so you grudgingly get up out of bed and eat some stale cereal. You study your notes for kicks for a couple hours, and go take your test on time. Lucky for you, the test was mostly covered in the notes! So you find yourself after a well rested night with a solid C in Russian History! Congrats way to be a slacker!
1)Start over ('start over')
2) END ('end')*
You decide to just relax. You sit back, plop down in a chair, and turn on some radiohead to keep yourself moving. Later you decide to watch a movie, and you get to bed early non-the less. You wake up in time for your final the next day and you cram a little bit right before the test. 20 minutes later you're walking out of class feeling fine. The test was easier than you thought. Good Job!!
1)Start over ('start over')
2) END ('end')*