Permalink
Browse files

keep on truckin'

  • Loading branch information...
1 parent 54f89d5 commit 1aa06135bcbed26980e615cf8e290e29ae79adee @jholton committed Feb 7, 2013
Showing with 1,762 additions and 0 deletions.
  1. +52 −0 ex36_brad.rb
  2. +154 −0 ex36_shannon.rb
  3. +183 −0 ex44.rb
  4. BIN ex45_brad.zip
  5. +31 −0 ex45_brad/disco.rb
  6. +6 −0 ex45_brad/game.rb
  7. +17 −0 ex45_brad/home.rb
  8. +13 −0 ex45_brad/level.rb
  9. +96 −0 ex45_brad/original.rb
  10. +33 −0 ex45_brad/woodstock.rb
  11. BIN ex45_shannon.zip
  12. +42 −0 ex45_shannon/dining_room.rb
  13. +23 −0 ex45_shannon/front_porch.rb
  14. +81 −0 ex45_shannon/game.rb
  15. +31 −0 ex45_shannon/kitchen.rb
  16. +22 −0 ex45_shannon/main_hall.rb
  17. +7 −0 ex45_shannon/player.rb
  18. 0 ex45_shannon/staircase.rb
  19. +10 −0 ex45_shannon/start.rb
  20. +17 −0 ex48/.gitignore
  21. +4 −0 ex48/Gemfile
  22. +22 −0 ex48/LICENSE.txt
  23. +29 −0 ex48/README.md
  24. +1 −0 ex48/Rakefile
  25. +19 −0 ex48/ex48.gemspec
  26. +5 −0 ex48/lib/ex48.rb
  27. +3 −0 ex48/lib/ex48/version.rb
  28. +55 −0 ex48/test/test_lexicon.rb
  29. +17 −0 lexicon/.gitignore
  30. +4 −0 lexicon/Gemfile
  31. +22 −0 lexicon/LICENSE.txt
  32. +29 −0 lexicon/README.md
  33. +1 −0 lexicon/Rakefile
  34. +19 −0 lexicon/lexicon.gemspec
  35. +146 −0 lexicon/lib/lexicon.rb
  36. +3 −0 lexicon/lib/lexicon/version.rb
  37. +100 −0 lexicon/test/test_lexicon.rb
  38. +17 −0 lexicon_bu/.gitignore
  39. +4 −0 lexicon_bu/Gemfile
  40. +22 −0 lexicon_bu/LICENSE.txt
  41. +29 −0 lexicon_bu/README.md
  42. +1 −0 lexicon_bu/Rakefile
  43. +19 −0 lexicon_bu/lexicon.gemspec
  44. +47 −0 lexicon_bu/lib/lexicon.rb
  45. +3 −0 lexicon_bu/lib/lexicon/version.rb
  46. +55 −0 lexicon_bu/test/test_lexicon.rb
  47. +83 −0 oop_test.rb
  48. +20 −0 projects/ex47/ex47.gemspec
  49. +19 −0 projects/ex47/lib/ex47.rb
  50. 0 projects/ex47/lib/ex47/version.rb
  51. +38 −0 projects/ex47/test/test_ex47.rb
  52. +17 −0 projects/tester/.gitignore
  53. +4 −0 projects/tester/Gemfile
  54. +22 −0 projects/tester/LICENSE.txt
  55. +29 −0 projects/tester/README.md
  56. +1 −0 projects/tester/Rakefile
  57. +4 −0 projects/tester/bin/hola
  58. +8 −0 projects/tester/lib/tester.rb
  59. +3 −0 projects/tester/lib/tester/version.rb
  60. +19 −0 projects/tester/tester.gemspec
  61. +1 −0 shannon/hard_way
View
@@ -0,0 +1,52 @@
+# start of game
+# time macine choice of 1969 or 1977
+# 1969 = woodstock
+# woodstock = brown acid or no brown acid
+# brown acid = bad trip wake up 15 hours later naked, and you missed the most historic concert of all time
+# no brown acid = you witnessed the most historic concert of all time and Jimi Hendrix invited you back stage to hang out.
+
+# 1977 = bad disco era
+# bad disco era = stab your own ear drum with an ice pick or buy some bell bottoms and join everyone under the disco ball
+# ice pick = you lost your hearing
+# bell bottoms = you meet the women of your dreams
+
+def prompt()
+ print '> '
+end
+
+def woodstock()
+ puts "The time machine puts you right in the middle of th Woodstock Music Festival."
+ puts "A man with a scragly beard offers you some famous brown acid."
+ puts "Do you accept or decline the brown acid?"
+
+ prompt; brown_acid = gets.chomp
+ if brown_acid == "accept"
+ bad_trip()
+ elsif brown_acid == "decline"
+ jimi_hendrix()
+ else
+ puts "Just get in the time machine and travel back home."
+ end
+end
+
+
+
+def start
+ puts "You sneak your way into a secret labratory, and find a time machine."
+ puts "The time machine only has two options of time travel. 1969 or 1977."
+ puts "What year would you like to travel back in time to?"
+
+ prompt; year_choice = gets.chomp
+
+ if year_choice.include? "69"
+ woodstock()
+ elsif year_choice.include? "77"
+ disco()
+ else
+ puts "You just broke the time machine and now owe the government 1 million dollars."
+ end
+end
+
+start()
+# I need to def disco, bad_trip, and jimi_hendrix
+# After I def disco I need to continue with other options for the game
View
@@ -0,0 +1,154 @@
+module Stuff
+ INVENTORY = []
+end
+
+def prompt()
+ print "> "
+end
+
+def start()
+ puts "You have arrived on a dark door step of an unfamilar house."
+ puts "You were given this address by a friend."
+ puts "There is a door in front of you, what would you like to do?"
+ puts "Knock on the door? Open the door?"
+
+ prompt; your_choice = gets.chomp
+
+ if your_choice.include? "knock"
+ puts "The door creeks open, but no one is behind it. You enter."
+ main_hall()
+ elsif your_choice.include? "open"
+ puts "The floor beneath you opens and you fall to your death. Maybe next time you should knock."
+ Process.exit(0)
+ else
+ puts "Nothing happens, and you wait on the porch until you starve to death."
+ Process.exit(0)
+ end
+end
+
+def main_hall()
+ puts "You are in the main hall of the house."
+ puts "There is a room to your right, a staircase, and a door to your left."
+ puts "What room would you like to go into?"
+
+ prompt; your_choice = gets.chomp
+
+ if your_choice.include?("right")
+ kitchen()
+ elsif your_choice.include?("left")
+ dining_room()
+ else
+ staircase()
+ end
+end
+
+def kitchen()
+ puts "You are in a kitchen."
+ puts "There is a candle and matches, a knife, and a pantry door."
+ puts "Would you like to take something, or search the pantry?"
+
+ prompt; your_choice = gets.chomp
+
+ if your_choice.include?("take")
+ puts "Which item would you like to take?"
+
+ prompt; take_something = gets.chomp
+
+ if take_something.include? "candle" || "matches"
+ Stuff::INVENTORY << 1
+ puts "You decide to return to the main hall with your candle and matches."
+ main_hall()
+ elsif take_something.include? "knife"
+ Stuff::INVENTORY << 2
+ puts "You decide to return to the main hall with your knife."
+ main_hall()
+ end
+
+ elsif your_choice.include? "search"
+ puts "You search the pantry and find a mutilated corpse."
+ puts "You drop dead from fear."
+ Process.exit(0)
+ end
+end
+
+def dining_room()
+ if Stuff::INVENTORY.include?(1)
+ puts "You are unable to see in this room so you light your candle."
+ puts "You are in a dining room."
+ puts "There is a key on the dining room table."
+ puts "You take the key, and head back to the main hall."
+ Stuff::INVENTORY << 3
+ main_hall()
+
+ else
+ puts "You are in a dark room."
+ puts "You can't see a thing."
+ puts "What would you like to do?"
+ puts "Attempt to search the room, call for help, or return to the main hall?"
+
+ prompt; your_choice = gets.chomp
+
+ if your_choice.include? "search"
+ puts "You wander aimlessly in this room and find nothing."
+ puts "You return to the main hall."
+ main_hall()
+ elsif your_choice.include? "call"
+ puts "You call out for help."
+ puts "You can hear someone whisper your name from behind."
+ puts "You felt safer in the main hall."
+ main_hall()
+ else
+ puts "you shouldn't see this."
+ end
+ end
+end
+
+def staircase()
+ if Stuff::INVENTORY.include?(1)
+ puts "You have a key that will fit this door."
+ puts "You put the key in the hole and open it."
+ puts "All your friends are waiting behind the door!"
+ puts "It's a surprise party!"
+ puts "Your friends have a sick sense of humor...."
+ Process.exit(0)
+ else
+ puts "The is a door at the top of the staircase."
+ puts "Would you like to open it?"
+
+ prompt; your_choice = gets.chomp
+
+ if your_choice.include? "yes"
+ puts "The door is locked, you decide to go back to the main hall."
+ main_hall()
+ else
+ puts "You return to the main hall."
+ main_hall()
+ end
+ end
+end
+
+start()
+
+
+#Haunted house
+#start off on the porch to the house
+#You must enter by knocking, the door will open with no one behind it.
+#if you try to open the door a trap door will open below you and you will fall to your death
+#you are in the main hall, there will be two rooms and a staircase
+#room 1 living room, it is dark, no lights.
+#go back to the main hall? Search for a light source? Call for help?
+#if search sudden death, to be determined.
+#call for help, whispers your name
+#room 2 the kitchen, there is a candle and matches, a knife, and a pantry
+#what would you like to do? if take add to inventory
+#if search death! not sure how yet
+#back to main hall?
+#staircase leads to a locked door. Would you like to try to open it?
+#if you try to open it, suprise nothing happens, lucky bastard.
+#after getting the candle and matches and taking them back to room 1 another prompt
+#would you like to light the candle? if so there are a set of keys on the dining room table
+#if the knife was taken and you try to search the room someone will push you from behind
+#sending you onto your knife to your death, congrats!!!!!! cant figure out!!
+#take the key, and another prompt on where to go next.
+#If you go to the stair case and use the key on the door, it will open to your suprise birthday party!
+#congrats your friends are dicks, what a surprise!
View
183 ex44.rb
@@ -0,0 +1,183 @@
+class Game
+
+ def initialize(start)
+ @quips = [
+ "You died. You kinda suck at this.",
+ "Nice job, you died ...jackass.",
+ "Such a luser.",
+ "I have a small puppy that's better at this."
+ ]
+ @start = start
+ end
+
+ def prompt()
+ print "> "
+ end
+
+ def play()
+ next_room = @start
+
+ while true
+ puts "\n--------"
+ room = method(next_room)
+ next_room = room.call()
+ end
+ end
+
+ def death()
+ puts @quips[rand(@quips.length())]
+ Process.exit(1)
+ end
+
+ def central_corridor()
+ puts "The Gothons of Planet Percal #25 have invaded your ship and destroyed"
+ puts "your entire crew. You are the last surviving member and your last"
+ puts "mission is to get the neutron destruct bomb from the Weapons Armory,"
+ puts "put it in the bridge, and blow the ship up after getting into an "
+ puts "escape pod."
+ puts "\n"
+ puts "You're running down the central corridor to the Weapons Armory when"
+ puts "a Gothon jumps out, red scaly skin, dark grimy teeth, and evil clown costume"
+ puts "flowing around his hate filled body. He's blocking the door to the"
+ puts "Armory and about to pull a weapon to blast you."
+
+ prompt()
+ action = gets.chomp()
+
+ if action == "shoot!"
+ puts "Quick on the draw you yank out your blaster and fire it at the Gothon."
+ puts "His clown costume is flowing and moving around his body, which throws"
+ puts "off your aim. Your laser hits his costume but misses him entirely. This"
+ puts "completely ruins his brand new costume his mother bought him, which"
+ puts "makes him fly into an insane rage and blast you repeatedly in the face until"
+ puts "you are dead. Then he eats you."
+ return :death
+
+ elsif action == "dodge!"
+ puts "Like a world class boxer you dodge, weave, slip and slide right"
+ puts "as the Gothon's blaster cranks a laser past your head."
+ puts "In the middle of your artful dodge your foot slips and you"
+ puts "bang your head on the metal wall and pass out."
+ puts "You wake up shortly after only to die as the Gothon stomps on"
+ puts "your head and eats you."
+ return :death
+
+ elsif action == "tell a joke"
+ puts "Lucky for you they made you learn Gothon insults in the academy."
+ puts "You tell the one Gothon joke you know:"
+ puts "Lbhe zbgure vf fb sng, jura fur fvgf nebhaq gur ubhfr, fur fvgf nebhaq gur ubhfr."
+ puts "The Gothon stops, tries not to laugh, then busts out laughing and can't move."
+ puts "While he's laughing you run up and shoot him square in the head"
+ puts "putting him down, then jump through the Weapon Armory door."
+ return :laser_weapon_armory
+
+ else
+ puts "DOES NOT COMPUTE!"
+ return :central_corridor
+ end
+ end
+
+ def laser_weapon_armory()
+ puts "You do a dive roll into the Weapon Armory, crouch and scan the room"
+ puts "for more Gothons that might be hiding. It's dead quiet, too quiet."
+ puts "You stand up and run to the far side of the room and find the"
+ puts "neutron bomb in its container. There's a keypad lock on the box"
+ puts "and you need the code to get the bomb out. If you get the code"
+ puts "wrong 10 times then the lock closes forever and you can't"
+ puts "get the bomb. The code is 3 digits."
+ code = "%s%s%s" % [rand(9)+1, rand(9)+1, rand(9)+1]
+ print "[keypad]> "
+ guess = gets.chomp()
+ guesses = 0
+
+
+ while guess != code and guesses < 10
+ puts "BZZZZEDDD!"
+ guesses += 1
+ print "[keypad]> "
+ guess = gets.chomp()
+ end
+
+ if guess == code
+ puts "The container clicks open and the seal breaks, letting gas out."
+ puts "You grab the neutron bomb and run as fast as you can to the"
+ puts "bridge where you must place it in the right spot."
+ return :the_bridge
+ else
+ puts "The lock buzzes one last time and then you hear a sickening"
+ puts "melting sound as the mechanism is fused together."
+ puts "You decide to sit there, and finally the Gothons blow up the"
+ puts "ship from their ship and you die."
+ return :death
+ end
+ end
+
+ def the_bridge()
+ puts "You burst onto the Bridge with the neutron destruct bomb"
+ puts "under your arm and surprise 5 Gothons who are trying to"
+ puts "take control of the ship. Each of them has an even uglier"
+ puts "clown costume than the last. They haven't pulled their"
+ puts "weapons out yet, as they see the active bomb under your"
+ puts "arm and don't want to set it off."
+
+ prompt()
+ action = gets.chomp()
+
+ if action == "throw the bomb"
+ puts "In a panic you throw the bomb at the group of Gothons"
+ puts "and make a leap for the door. Right as you drop it a"
+ puts "Gothon shoots you right in the back killing you."
+ puts "As you die you see another Gothon frantically try to disarm"
+ puts "the bomb. You die knowing they will probably blow up when"
+ puts "it goes off."
+ return :death
+
+ elsif action == "slowly place the bomb"
+ puts "You point your blaster at the bomb under your arm"
+ puts "and the Gothons put their hands up and start to sweat."
+ puts "You inch backward to the door, open it, and then carefully"
+ puts "place the bomb on the floor, pointing your blaster at it."
+ puts "You then jump back through the door, punch the close button"
+ puts "and blast the lock so the Gothons can't get out."
+ puts "Now that the bomb is placed you run to the escape pod to"
+ puts "get off this tin can."
+ return :escape_pod
+ else
+ puts "DOES NOT COMPUTE!"
+ return :the_bridge
+ end
+ end
+
+ def escape_pod()
+ puts "You rush through the ship desperately trying to make it to"
+ puts "the escape pod before the whole ship explodes. It seems like"
+ puts "hardly any Gothons are on the ship, so your run is clear of"
+ puts "interference. You get to the chamber with the escape pods, and"
+ puts "now need to pick one to take. Some of them could be damaged"
+ puts "but you don't have time to look. There's 5 pods, which one"
+ puts "do you take?"
+
+ good_pod = rand(5)+1
+ print "[pod #]>"
+ guess = gets.chomp()
+
+ if guess.to_i != good_pod
+ puts "You jump into pod %s and hit the eject button." % guess
+ puts "The pod escapes out into the void of space, then"
+ puts "implodes as the hull ruptures, crushing your body"
+ puts "into jam jelly."
+ return :death
+ else
+ puts "You jump into pod %s and hit the eject button." % guess
+ puts "The pod easily slides out into space heading to"
+ puts "the planet below. As it flies to the planet, you look"
+ puts "back and see your ship implode then explode like a"
+ puts "bright star, taking out the Gothon ship at the same"
+ puts "time. You won!"
+ Process.exit(0)
+ end
+ end
+end
+
+a_game = Game.new(:central_corridor)
+a_game.play()
View
Binary file not shown.
Oops, something went wrong.

0 comments on commit 1aa0613

Please sign in to comment.