Class: PaitinHangman::Paitin
- Inherits:
-
Object
- Object
- PaitinHangman::Paitin
show all
- Includes:
- SimpleMethods
- Defined in:
- lib/paitin_hangman.rb
Instance Method Summary
collapse
#decide, #length_one?, #number?, #option_integrity, #unique?, #verify_name_integrity
Instance Method Details
#choice_integrity(choice) ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/paitin_hangman.rb', line 21
def choice_integrity(choice)
case choice
when "p", "play" then new_game
when "i", "instruction" then instruction
when "q", "quit" then exit
when "l", "load" then GameResumption.new
else
try_again
end
end
|
#game_control ⇒ Object
11
12
13
14
|
# File 'lib/paitin_hangman.rb', line 11
def game_control
Message.welcome
process
end
|
#instruction ⇒ Object
37
38
39
40
|
# File 'lib/paitin_hangman.rb', line 37
def instruction
Message.instruction
process
end
|
#new_game ⇒ Object
42
43
44
45
46
47
|
# File 'lib/paitin_hangman.rb', line 42
def new_game
Message.game_intro
name = verify_name_integrity
puts "Hi #{name}, Select a mode"
play(name)
end
|
#play(name) ⇒ Object
> This technically begins the game
#process ⇒ Object
16
17
18
19
|
# File 'lib/paitin_hangman.rb', line 16
def process
choice = gets.chomp.downcase
choice_integrity(choice)
end
|
#try_again ⇒ Object
32
33
34
35
|
# File 'lib/paitin_hangman.rb', line 32
def try_again
Message.valid_option
process
end
|