Class: Players::Human
Constant Summary
Constants included from Emoji
Emoji::DASH, Emoji::O, Emoji::X
Instance Attribute Summary
Attributes inherited from Player
Instance Method Summary collapse
-
#initialize(params) ⇒ Human
constructor
A new instance of Human.
- #make_move(board) ⇒ Object
Constructor Details
#initialize(params) ⇒ Human
Returns a new instance of Human.
5 6 7 8 |
# File 'lib/ttt-cli/players/human.rb', line 5 def initialize(params) super(params) @name = 'Human' unless params[:name] end |
Instance Method Details
#make_move(board) ⇒ Object
10 11 12 13 14 15 16 17 |
# 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 |