Class: Tictactoe::HumanPlayer
- Defined in:
- lib/tictactoe/humanplayer.rb
Instance Attribute Summary
Attributes inherited from Player
Instance Method Summary collapse
Methods inherited from Player
Constructor Details
This class inherits a constructor from Tictactoe::Player
Instance Method Details
#move(board) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/tictactoe/humanplayer.rb', line 5 def move( board ) print board moves = board.moves print "Your move? (format: b3) " move = $stdin.gets until moves.include?(move.chomp.downcase) print "Invalid move. Try again. " move = $stdin.gets end move.chomp end |