Class: PaitinHangman::Computer
- Inherits:
-
Object
- Object
- PaitinHangman::Computer
- Defined in:
- lib/paitin_hangman/computer.rb
Instance Method Summary collapse
-
#initialize ⇒ Computer
constructor
A new instance of Computer.
- #level(choice, name) ⇒ Object
- #level_integrity(name) ⇒ Object
Constructor Details
#initialize ⇒ Computer
Returns a new instance of Computer.
3 4 5 |
# File 'lib/paitin_hangman/computer.rb', line 3 def initialize Message.level_choice end |
Instance Method Details
#level(choice, name) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/paitin_hangman/computer.rb', line 16 def level(choice, name) case choice when "1" then Levels.new(name, 4, 8, 10) when "2" then Levels.new(name, 9, 12, 12) when "3" then Levels.new(name, 13, 25, 15) end end |
#level_integrity(name) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/paitin_hangman/computer.rb', line 7 def level_integrity(name) choice = gets.chomp until choice == "1" || choice == "2" || choice == "3" puts "Please press either '1', '2' or '3'" choice = STDIN.gets.chomp end level(choice, name) end |