lib/pgn/move_calculator.rb
# Specifies the movement of pieces who are allowed to move in a
# given direction until they reach an obstacle or the end of the
# board.
#
Specifies the movement of pieces who are allowed to move in a
given direction until they reach an obstacle or the end of the
board.
Specifies the movement of pieces who are allowed to move in a given direction until they reach an obstacle or the end of the board .
def changes
      changes = {}
      changes.merge!(CASTLING[self.move.castle]) if self.move.castle
      changes.merge!(
        self.origin           => nil,
        self.move.destination => self.move.piece,
        en_passant_capture    => nil,
      )
      if self.move.promotion
        changes[self.move.destination] = self.move.promotion
      end
      changes.reject! {|key, _| key.nil? or key.empty? }
      changes
    end
def changes changes = { } changes . merge! ( CASTLING [ self . move . castle ] ) if self . move . castle changes . merge! ( self . origin => nil , self . move . destination => self . move . piece , en_passant_capture => nil , ) if self . move . promotion changes [ self . move . destination ] = self . move . promotion end changes . reject! { | key , _ | key . nil? or key . empty? } changes end
Specifies the movement of pieces who are allowed to move in a
given direction until they reach an obstacle or the end of the
board.
Specifies the movement of pieces who are allowed to move in a given direction until they reach an obstacle or the end of the board .