class Players::Human
Public Class Methods
new(params)
click to toggle source
Calls superclass method
Player::new
# File lib/ttt-cli/players/human.rb, line 5 def initialize(params) super(params) @name = 'Human' unless params[:name] end
Public Instance Methods
make_move(board)
click to toggle source
# File lib/ttt-cli/players/human.rb, line 10 def make_move(board) move = position if !board.cell_taken?(move) board.fill_cell(move, @token) else make_move(board) end end
Private Instance Methods
position()
click to toggle source
# File lib/ttt-cli/players/human.rb, line 21 def position CommandLine::Display.choose_cell end