Class: Help
- Inherits:
-
Object
- Object
- Help
- Defined in:
- lib/Help.rb
Constant Summary collapse
- @@line =
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
Instance Method Summary collapse
-
#help ⇒ Object
To control all the options to bring help to the player.
-
#help_ExamplePoints ⇒ Object
To display an example of how works the make points.
-
#help_HowManyPoints ⇒ Object
To display how many points do you need for win.
-
#help_HowToDoPoints ⇒ Object
To display the options of how can you do Points.
-
#help_players ⇒ Object
To display how many player can play.
-
#initialize ⇒ Help
constructor
A new instance of Help.
-
#pressToContinue ⇒ Object
To display the confirmation.
-
#space ⇒ Object
To put space between the menu and the option that was selectionated.
Constructor Details
#initialize ⇒ Help
Returns a new instance of Help.
2 |
# File 'lib/Help.rb', line 2 def initialize; end |
Instance Method Details
#help ⇒ Object
To control all the options to bring help to the player
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/Help.rb', line 6 def help check = false loop do system('clear') puts "Rules of the game" puts @@line.colorize(:light_blue) puts "1) How many player can be? " puts "2) How can I do make points? " puts "3) Example of making points. " puts "4) How many points do I need to win? " puts "5) Exit or just enter to START the game. ".colorize(:red) puts @@line.colorize(:light_blue) print "Option: " answer = gets.chomp.to_i case answer when 0 check = true when 1 space help_players when 2 space help_HowToDoPoints when 3 space help_ExamplePoints when 4 space help_HowManyPoints when 5 check = true else print "Sorry I don't know." system('clear') end break if check end system('clear') end |
#help_ExamplePoints ⇒ Object
To display an example of how works the make points
83 84 85 86 87 88 89 90 |
# File 'lib/Help.rb', line 83 def help_ExamplePoints puts " Throw Score" puts "--------- ------------------" puts "5 1 3 4 1 50 + 2 * 100 = 250" puts "1 1 1 3 1 1000 + 100 = 1100" puts "2 4 4 5 4 400 + 50 = 450" pressToContinue end |
#help_HowManyPoints ⇒ Object
To display how many points do you need for win
93 94 95 96 |
# File 'lib/Help.rb', line 93 def help_HowManyPoints puts " You need to have 1500 or more points to win the game." pressToContinue end |
#help_HowToDoPoints ⇒ Object
To display the options of how can you do Points
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/Help.rb', line 66 def help_HowToDoPoints puts "Each player takes a turn consisting of one or more rolls of the dice." puts "On the first roll of the game, a player rolls all five dice which are" puts "scored according to the following:" puts "\n" puts "\tThree 1's => 1000 points" puts "\tThree 6's => 600 points" puts "\tThree 5's => 500 points" puts "\tThree 4's => 400 points" puts "\tThree 3's => 300 points" puts "\tThree 2's => 200 points" puts "\tOne 1 => 100 points" puts "\tOne 5 => 50 points" pressToContinue end |
#help_players ⇒ Object
To display how many player can play
59 60 61 62 63 |
# File 'lib/Help.rb', line 59 def help_players puts "Greed is a dice game played among 2 or more players, using 5" puts "six-sided dice." pressToContinue end |
#pressToContinue ⇒ Object
To display the confirmation
52 53 54 55 56 |
# File 'lib/Help.rb', line 52 def pressToContinue puts "\n" print "Press enter to continue. " gets.chomp end |
#space ⇒ Object
To put space between the menu and the option that was selectionated
47 48 49 |
# File 'lib/Help.rb', line 47 def space 3.times { puts "\n"} end |