Class: HumanPlayer

Inherits:
Object
  • Object
show all
Defined in:
lib/players/human_player.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(color) ⇒ HumanPlayer

Returns a new instance of HumanPlayer.



5
6
7
# File 'lib/players/human_player.rb', line 5

def initialize(color)
  @color = color
end

Instance Attribute Details

#board=(value) ⇒ Object (writeonly)

Sets the attribute board

Parameters:

  • value

    the value to set the attribute board to.



3
4
5
# File 'lib/players/human_player.rb', line 3

def board=(value)
  @board = value
end

#colorObject (readonly)

Returns the value of attribute color.



2
3
4
# File 'lib/players/human_player.rb', line 2

def color
  @color
end

Instance Method Details

#make_moveObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/players/human_player.rb', line 9

def make_move
  # puts "Enter your move"
  # i1, i2 = gets.chomp.split
  # raise BadInputError if i2.nil?

  i1 = @board.move_cursor

  i2 = @board.move_cursor

  [i1, i2]
end