Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }