public bool IsThreefoldRepetition() { if (NullMoves == 0 && _hashes.Count() >= 8) { var first = _hashes.Peek(3); var second = _hashes.Peek(7); if (Hash == first && first == second) { return(true); } } return(false); }
public bool IsThreefoldRepetition() { var positionsToCheck = Math.Min(_hashes.Count(), IrreversibleMovesCount + 1); if (NullMoves == 0 && positionsToCheck >= 8) { var repetitionsCount = 1; for (var positionIndex = 1; positionIndex < positionsToCheck; positionIndex += 2) { if (_hashes.Peek(positionIndex) == Hash) { repetitionsCount++; if (repetitionsCount >= 3) { return(true); } } } } return(false); }