Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.19 KB | None | 0 0
  1. #Gets the users name
  2. puts "What is your name?"
  3. main_Char = gets.chomp.strip
  4.  
  5. #Intro
  6. puts "You enter a spooky cave"
  7. puts "Do you light your torch? (yes/no)"
  8.  
  9. #First Level
  10. option = gets.chomp.downcase.strip
  11.  
  12.     case option
  13.        when "yes"
  14.            puts "#{main_Char} sees two paths leading Left and Right"
  15.        when "no"
  16.            puts "#{main_Char} is eaten by a large bug.
  17.                 Sorry, please try again"
  18.             exit
  19.        else
  20.         puts "#{main_Char} is eaten by a large bug.
  21.                 Sorry, please try again"
  22.         exit
  23.        
  24.     end
  25.  
  26. #Second Level
  27. puts "Will #{main_Char} go left or right? (left/right)"
  28. direction = gets.chomp.downcase
  29.     case direction
  30.         when "left"
  31.             puts "#{main_Char} enters a room with a chest in it, does #{main_Char} open it?"
  32.         when "right"
  33.             puts "#{main_Char} falls into an infinite loop bug.
  34.    Sorry, please try again."
  35.               exit
  36.     end
  37.  
  38. #Third level
  39. puts "Will #{main_Char} open the chest? (yes/no)"
  40. chest = gets.chomp.downcase.strip
  41.     case chest
  42.         when "yes"
  43.             puts "#{main_Char} finds 300 gold coins and a map"
  44.         when "no"
  45.             puts "#{main_Char} wanders through the labrynthian maze of tunnels and passages until they pass out
  46.    Sorry, please try again"
  47.         exit
  48.     end
  49.  
  50. #Fourth Level
  51. puts "Will #{main_Char} read the map?(yes/no)"
  52. the_map = gets.chomp.downcase.strip
  53.  
  54.     case the_map
  55.         when "yes"
  56.             puts "#{main_Char} finds the path to the Main Room, where the goal of their quest is!"
  57.         when "no"
  58.             puts "#{main_Char} never finds the goal of their quest and becomes lost in The Cave
  59. Sorry, please try again"
  60.         exit
  61.     end
  62.  
  63. #end of game
  64. puts "#{main_Char} has found the object of their quest, The Sword of Ruby. #{main_Char} can now go
  65. and finish their quest to become the greatest progammer"
  66.  
  67. puts "Are you happy?"
  68. happy = gets.chomp.downcase.strip
  69.     case happy
  70.         when "yes"
  71.             puts "#{main_Char} has won the game"
  72.         when "no"
  73.             puts "#{main_Char} does not know why they played"
  74.     end
  75. puts "Thank you, #{main_Char}, for playing my game"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement