def move_knight(p1)
      row = get_row_from_index(p1)
      col = get_col_from_index(p1)

      valid = []
      valid_moves_no_friendly_fire = []

      # Valid knight moves based on its board position
      valid << (p1 + 17) if row < 7 && col < 8
      valid << (p1 + 15) if row < 7 && col > 1
      valid << (p1 + 10) if row < 8 && col < 7
      valid << (p1 + 6)  if row < 8 && col > 2
      valid << (p1 - 6)  if row > 1 && col < 7
      valid << (p1 - 10) if row > 1 && col > 2
      valid << (p1 - 15) if row > 2 && col < 8
      valid << (p1 - 17) if row > 2 && col > 1

      # All possible moves for the knight based on board boundaries will added
      # This iterator filters for friendly fire, and removes indexes pointing to same color pices
      valid.each do |pos|
        valid_moves_no_friendly_fire << pos unless piece_color(pos) == Move.color
      end

      valid_moves_no_friendly_fire
    end
def move_knight(p1)
      row = get_row_from_index(p1)
      col = get_col_from_index(p1)

      valid = []
      valid_moves_no_friendly_fire = []

      # Valid knight moves based on its board position
      valid << (p1 + 17) if row < 7 && col < 8
      valid << (p1 + 15) if row < 7 && col > 1
      valid << (p1 + 10) if row < 8 && col < 7
      valid << (p1 + 6)  if row < 8 && col > 2
      valid << (p1 - 6)  if row > 1 && col < 7
      valid << (p1 - 10) if row > 1 && col > 2
      valid << (p1 - 15) if row > 2 && col < 8
      valid << (p1 - 17) if row > 2 && col > 1

      # All possible moves for the knight based on board boundaries will added
      # This iterator filters for friendly fire, and removes indexes pointing to same color pices
      valid.each do |pos|
        valid_moves_no_friendly_fire << pos unless piece_color(pos) == Move.color
      end

      valid_moves_no_friendly_fire
    end
Returns valid positions a knight at index p1 can move to