class TicTacToe::Start
Public Class Methods
new()
click to toggle source
# File lib/tic_tac_toe/start.rb, line 4 def initialize @players_name_number = 1 @players_name = [] end
Public Instance Methods
start()
click to toggle source
# File lib/tic_tac_toe/start.rb, line 9 def start console.display_beginning_instructions @players_name_number = console.input_mode enter_players_name play_until_no_more_replay end
Private Instance Methods
console()
click to toggle source
# File lib/tic_tac_toe/start.rb, line 17 def console Console.instance end
enter_players_name()
click to toggle source
# File lib/tic_tac_toe/start.rb, line 33 def enter_players_name @players_name_number.times { |count| @players_name[count] = console.input_name(player_number: count) } end
play_until_no_more_replay()
click to toggle source
# File lib/tic_tac_toe/start.rb, line 21 def play_until_no_more_replay replay = true while replay start_game replay = replay? end end
replay?()
click to toggle source
# File lib/tic_tac_toe/start.rb, line 29 def replay? console.input_replay.eql?('y') end
start_game()
click to toggle source
# File lib/tic_tac_toe/start.rb, line 37 def start_game console.clear_console Gameplay.new(Checker.new, console, @players_name).play end