From e1e8946a393a07bd21f31efef864866fe802ce61 Mon Sep 17 00:00:00 2001 From: weiwei lin Date: Tue, 14 Oct 2014 12:33:26 -0400 Subject: [PATCH 1/3] 12:33 --- README.md | 8 -------- myGame.rb | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 myGame.rb diff --git a/README.md b/README.md index 4cf029b..6bc355a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1 @@ # 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*. - -![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. diff --git a/myGame.rb b/myGame.rb new file mode 100644 index 0000000..4b70785 --- /dev/null +++ b/myGame.rb @@ -0,0 +1,26 @@ +HP = 100 +def status() + puts "HP:#{HP}" +end + +def checker(hp) + if hp <= 0 + abort('You are dead!') + end +end + +def classroom() + puts + puts "You are in the classroom, and " +end + +def gameStart() + puts + puts "The end of the world..." + puts + print "Press *Enter* to continue..." + gets.chomp + classroom() +end + +gameStart() \ No newline at end of file From 2d374d8feef422fad974b5d1d2ad42776df8f01c Mon Sep 17 00:00:00 2001 From: Weiwei Lin Date: Tue, 14 Oct 2014 18:31:03 -0400 Subject: [PATCH 2/3] 6:31 --- myGame.rb | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 89 insertions(+), 9 deletions(-) diff --git a/myGame.rb b/myGame.rb index 4b70785..108a0b2 100644 --- a/myGame.rb +++ b/myGame.rb @@ -1,17 +1,98 @@ -HP = 100 -def status() - puts "HP:#{HP}" +def terminator() + abort('You are dead!') end -def checker(hp) - if hp <= 0 - abort('You are dead!') +def choose() + ans = gets.chomp + while ans!= "1" and ans!= "2" and ans!= "3" + puts "please enter a proper number" + ans = gets.chomp end + return ans.to_i +end +def rooftop() + puts "You go up to the rooftop and lock the door." + puts "what do you want to do?" + puts "1. Make an S.O.S pattern using your clothes 2. Burn your clothes using the lighter in your pocket 3. There is no zombie on the ground! Let's JUMMMMMMMMMMP!" + ans = choose + if ans == 1 + puts "Your clothes are blowing away and the zombie come up find you!" + terminator + end + if ans == 2 + puts "Forgot to tell you that it is 10m above the ground!!" + terminator + end + puts "A helicopter finds you!" + abort("Your are survived") +end + +def thirdflood() + puts "There are three class rooms in this floor." + puts "You can only go to one room because you don't have enough time!" + puts "1. music classroom 2. Library 3. GYM" + ans = choose + if ans == 1 + puts "You find your music teacher! But a zombie music teacher" + terminator + end + if ans == 2 + puts "Wow!!! You find the portal!!!" + abort("You are survived!!") + end + puts "You find nothing in the GYM and the zombie is approaching!" + rooftop +end + +def hallway() + puts "The restroom is in front of you. Staircase is at the left side and elevator is at the right hand side." + puts "Where do you run?" + puts "1. restroom 2. staircase 3. elevator" + ans = choose + if ans == 1 + puts "It is a dead end! You have no way to flee!" + terminator + end + if ans == 2 + thirdflood() + end + puts "Zombies are taking over this city! It is black out everywhere!" + terminator +end + +def school() + puts "A group of zombie see you and they want some fresh meat!" + puts "Where do you run?" + puts "1. left 2. right 3. go back to the building" + ans = choose + if ans == 1 or ans == 2 + puts "You just sprain your leg. You can't run faster than zombie!" + terminator + end + puts "You step back into the building." + hallway() end def classroom() - puts - puts "You are in the classroom, and " + puts "You are in the classroom and a zombie is wandering outside of the room." + puts "What do you going to do?" + puts "1. Hide behind the table 2. Run from the back door 3. Jump out of the window" + ans = choose + if ans == 1 + puts "The zombie smells u out!" + puts "You have to do something quickly!" + puts "1. Try to kill the zombie 2. Run from the back door 3. Jump out of the window" + ans = choose + if ans == 1 + puts "You are bitten by the zombie" + terminator + end + end + if ans == 2 + hallway() + end + puts "You jump out from second floor and fall on the grass" + school() end def gameStart() @@ -22,5 +103,4 @@ def gameStart() gets.chomp classroom() end - gameStart() \ No newline at end of file From 7c6e70c1fea67f79252593731d03abd5a12aef01 Mon Sep 17 00:00:00 2001 From: Weiwei Lin Date: Tue, 14 Oct 2014 18:33:54 -0400 Subject: [PATCH 3/3] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6bc355a..1532610 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ -# Choose Your Own Adventure +#My Adventure + +Run the myGame.py from terminal and enjoy!!