class PaitinHangman::Paitin

Public Instance Methods

choice_integrity(choice) click to toggle source
# 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() click to toggle source
# File lib/paitin_hangman.rb, line 11
def game_control
  Message.welcome
  process
end
instruction() click to toggle source
# File lib/paitin_hangman.rb, line 37
def instruction
  Message.instruction
  process
end
new_game() click to toggle source
# 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) click to toggle source

> This technically begins the game

# File lib/paitin_hangman.rb, line 50
def play(name)
  Message.game_type
  option_integrity
  if @option == "2"
    Computer.new.level_integrity(name)
  else
    Player.new.first_player_name(name)
  end
end
process() click to toggle source
# File lib/paitin_hangman.rb, line 16
def process
  choice = gets.chomp.downcase
  choice_integrity(choice)
end
try_again() click to toggle source
# File lib/paitin_hangman.rb, line 32
def try_again
  Message.valid_option
  process
end