module EnPassantHelpers
Public Instance Methods
execute_en_passant(piece, row, column)
click to toggle source
# File lib/bchess/helpers/en_passant_helpers.rb, line 7 def execute_en_passant(piece, row, column) piece.move(row, column) remove_old_piece(*remove_en_passant(piece, *transform_field(@en_passant)), piece.color) end
long_pawn_move(piece, column, row)
click to toggle source
# File lib/bchess/helpers/en_passant_helpers.rb, line 17 def long_pawn_move(piece, column, row) piece.move(column, row) direction = piece.color == Bchess::WHITE ? 1 : -1 @en_passant = field(column, (row + piece.row) / 2 - direction) end
remove_en_passant(piece, column, row)
click to toggle source
# File lib/bchess/helpers/en_passant_helpers.rb, line 12 def remove_en_passant(piece, column, row) direction = piece.color == Bchess::WHITE ? 1 : -1 [column, row - direction] end
validate_en_passant(_piece, _column, _row)
click to toggle source
# File lib/bchess/helpers/en_passant_helpers.rb, line 2 def validate_en_passant(_piece, _column, _row) # TODO true end