lib/chess/state.rb
###
# Draw by threefold repitition can be claimed if the position on the
# board occured for the third time or if such a repitition is reached
# with one of the possible legal moves.
###
Draw by threefold repitition can be claimed if the position on the
board occured for the third time or if such a repitition is reached
with one of the possible legal moves.
Draw by threefold repitition can be claimed if the position on the board occured for the third time or if such a repitition is reached with one of the possible legal moves .
def can_claim_threefold_repitition?
      if transpositions[zobrist_hash()] >= 3
        return true
      end
      generate_pseudo_legal_moves.each_with_index do |move, i|
        self.move(move)
        transpositions[zobrist_hash()] ||= 1
        if !was_into_check? && @transpositions[zobrist_hash()] >= 3
          undo
          return true
        end
        undo
      end
      return false
    end
def can_claim_threefold_repitition? if transpositions [ zobrist_hash ( ) ] >= 3 return true end generate_pseudo_legal_moves . each_with_index do | move , i | self . move ( move ) transpositions [ zobrist_hash ( ) ] ||= 1 if ! was_into_check? && @transpositions [ zobrist_hash ( ) ] >= 3 undo return true end undo end return false end
Draw by threefold repitition can be claimed if the position on the
board occured for the third time or if such a repitition is reached
with one of the possible legal moves.
Draw by threefold repitition can be claimed if the position on the board occured for the third time or if such a repitition is reached with one of the possible legal moves .
# Threefold repitition occured. # The next legal move is a threefold repitition.