Created
January 12, 2015 05:31
-
-
Save troyleach/899ffdd79a0a1be6e160 to your computer and use it in GitHub Desktop.
This is a runner file for bottles beer, deaf grandma leap year
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #At the bottom of this file you will find a utilities file that I put together for such things as | |
| #lines and clear screen function!! | |
| #I am working on the last screen cast with the answer the 3 question bit! sorry it isn't done! | |
| require_relative 'bottles_beer' | |
| require_relative 'deaf_grandma' | |
| require_relative 'leap_display' | |
| require_relative 'runner_utili' | |
| reset_screen! | |
| puts "=" * 50 | |
| puts "WELCOME TO MY MY RUBY PROGRAM" | |
| puts "=" * 50 | |
| while true | |
| puts <<-STRING | |
| What would you like to do? | |
| 1 => bottles of beer | |
| 2 => deaf grandma | |
| 3 => leap year 1 | |
| 4 => leap year 2 | |
| 5 => exit | |
| STRING | |
| print "Choice: " | |
| choice = gets.chomp.downcase | |
| if choice == "1" | |
| play = Beer.new | |
| play.while_beer | |
| wait | |
| reset_screen! | |
| elsif choice == "2" | |
| play = Grandma.new | |
| play.talk | |
| wait | |
| reset_screen! | |
| elsif choice == "3" | |
| start = Display.new | |
| puts start.single_year | |
| wait | |
| reset_screen! | |
| elsif choice == "4" | |
| start = Display.new | |
| puts start.get_input | |
| wait | |
| reset_screen! | |
| elsif choice == "5" | |
| break | |
| else | |
| puts "I don't understand" | |
| end | |
| end | |
| reset_screen! | |
| puts "=" * 50 | |
| puts "THANKS FOR TAKING THE TIME, HAVE AN AWESOME DAY!!!" | |
| puts | |
| # - - - - - - - - - - - - - - - - utilities file - - - - - - - - - | |
| def clear_screen! | |
| print "\e[2J" | |
| end | |
| def move_to_home! | |
| print "\e[H" | |
| end | |
| def reset_screen! | |
| clear_screen! | |
| move_to_home! | |
| end | |
| def wait | |
| 5.times do | |
| sleep(1) | |
| print "." | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You're amazing.