lib/chess/board.rb
# Helper function to move_piece that accounts for special pawn
# rules such as en passant, promotion, and moved/not moved
Helper function to move_piece that accounts for special pawn
rules such as en passant, promotion, and moved/not moved
Helper function to move_piece that accounts for special pawn rules such as en passant promotion and moved / not moved
def special_pawn_rules(moved_piece, from_row, to_column)
      if en_passant_allowed?(moved_piece, from_row)
          moved_piece.allow_en_passant = true
      end
      if valid_en_passant_move?(moved_piece.color, from_row, to_column)
        @state[from_row][to_column] = nil
      end
      if promotion?(moved_piece)
        moved_piece.can_promote = true
      end
      moved_piece.moved = true
    end
def special_pawn_rules ( moved_piece , from_row , to_column ) if en_passant_allowed? ( moved_piece , from_row ) moved_piece . allow_en_passant = true end if valid_en_passant_move? ( moved_piece . color , from_row , to_column ) @state [ from_row ] [ to_column ] = nil end if promotion? ( moved_piece ) moved_piece . can_promote = true end moved_piece . moved = true end
Helper function to move_piece that accounts for special pawn
rules such as en passant, promotion, and moved/not moved
Helper function to move_piece that accounts for special pawn rules such as en passant promotion and moved / not moved
moved_piece
<not_specific>
from_row
<not_specific>
to_column
<not_specific>