lib/chess/board.rb
# Given a location of a piece and the set of possible moves, returns
# an array of all valid moves for that piece given the board state
Given a location of a piece and the set of possible moves, returns
an array of all valid moves for that piece given the board state
Given a location of a piece and the set of possible moves returns an array of all valid moves for that piece given the board state
def all_valid_moves(location, moves)
      moves.select do |move|
        valid_move?(location[0], location[1], move[0], move[1])
      end
    end
def all_valid_moves ( location , moves ) moves . select do | move | valid_move? ( location [ 0 ] , location [ 1 ] , move [ 0 ] , move [ 1 ] ) end end
Given a location of a piece and the set of possible moves, returns
an array of all valid moves for that piece given the board state
Given a location of a piece and the set of possible moves returns an array of all valid moves for that piece given the board state
location
<not_specific>
moves
<not_specific>