lib/chess/pawn.rb
# Returns an array with all moves the pawn can make on the board,
# assuming the board is empty
Returns an array with all moves the pawn can make on the board,
assuming the board is empty
Returns an array with all moves the pawn can make on the board assuming the board is empty
def possible_moves
      row = @location[0]
      column = @location[1]
      moves = []
      unless row == 7
        if @color == "white"
          moves = white_pawn_moves(row, column)
        else
          moves = black_pawn_moves(row, column)
        end
      end
      moves.select do |position|
        position.all? { |value| value.between?(0,7) }
      end
    end
def possible_moves row = @location [ 0 ] column = @location [ 1 ] moves = [ ] unless row == 7 if @color == "white" moves = white_pawn_moves ( row , column ) else moves = black_pawn_moves ( row , column ) end end moves . select do | position | position . all? { | value | value . between? ( 0 , 7 ) } end end
Returns an array with all moves the pawn can make on the board,
assuming the board is empty
Returns an array with all moves the pawn can make on the board assuming the board is empty