20/05

parent ad052c9c
def gold_room
def gold_room
puts "This room is full of gold. How much do you take?"
print "> "
......@@ -87,5 +87,5 @@ def gold_room
dead("You stumble around the room until you starve.")
end
end
gold_room()
\ No newline at end of file
start
def dinasour_land
puts %Q{
\tThis land has a Dinasour challenge.
\tThe Dinasour is slepping in front of the door.
\tHow are you going to pass the room?
\tYou can choose a meat or a gun???.
}
dinasour_moved = false
while true
print ">>"
choice = $stdin.gets.chomp
if(choice == "meat")
dead "You're so funny but Dinasour will eat you first!!!"
elsif choice == "gun" && !dinasour_moved
puts "Oh Dinasour was kill."
quiz_land
dinasour_moved = true
elsif choice == "gun" && dinasour_moved
dead ("The dinasour gets angry and start chewing your head")
else
puts "I got no idea what that means."
end
end
end
def quiz_land
puts %Q{
\tWelcome to quiz land.
\tYou have 2 questions.
\tIf you answer right both of them.
\tYou will keep going.
}
while true
puts %q{
You need to send a value back to the code that called it (return a value to the caller).
Which method can/should be used for this?
A. return
B. replay
C. post
D. send
}
print ">>"
choice = $stdin.gets.chomp
if choice == "A"
puts" Excelent! Next question"
else
dead "You can try again!"
end
puts %q{
Excellent!!!.
You need to convert the string salt to a number in order to see if it exceeds a cutoff value.
Which of the following methods should be used to accomplish this?
A. interger
B. num
C. declare.i
D. to_i
}
choice = $stdin.gets.chomp
if choice == "D"
puts "Congratulation!!! open the door to go next room"
luxury_room
else
dead "You can try again:))"
end
end
end
def luxury_room
puts %Q{
\tHello traveller.
\tWelcome to last room. This is treasure_room.
\tThe room has many gold, ruby and a key in them.
\tWhat is your choose? find a key or quit.
}
print ">>"
choice = $stdin.gets.chomp
if choice.include? "find"
dead "you Win!!!"
elsif choice.include? "quit"
dead "Hope see you soon"
else
puts"Please, choose"
end
end
def dead(why)
puts why, "Bye!"
exit(0)
end
def start
puts %Q{
------------------------------------------------
Hello traveller! Welcome you to Teyat land.
Now you choose land
which you want to challenge
dinasour land or quiz land?
------------------------------------------------
}
print ">>"
choice = $stdin.gets.chomp
if choice.include? "dinasour"
dinasour_land
elsif choice.include? "quiz"
quiz_land
else
puts "please choose the land, traveller"
end
end
start
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment