lib/chess/board.rb
# Returns true if for a given color and location, the location is
# on the board and contains a piece of the color
Returns true if for a given color and location, the location is
on the board and contains a piece of the color
Returns true if for a given color and location the location is on the board and contains a piece of the color
def valid_player_piece?(color, location)
      return false unless location.all? { |c| c.between?(0,7) }
      potential_piece = @state[location[0]][location[1]]
      potential_piece != nil && potential_piece.color == color
    end
def valid_player_piece? ( color , location ) return false unless location . all? { | c | c . between? ( 0 , 7 ) } potential_piece = @state [ location [ 0 ] ] [ location [ 1 ] ] potential_piece != nil && potential_piece . color == color end
Returns true if for a given color and location, the location is
on the board and contains a piece of the color
Returns true if for a given color and location the location is on the board and contains a piece of the color
color
<not_specific>
location
<not_specific>