Пример #1
0
        void ComputeHashCode()
        {
            _hashCode = (int)(N);
            UpdateHash(ref _hashCode, (long)(Turn));

            Degrees.Clear();
            DegreeChangeIndices.Clear();

            Degrees.AddRange(PotSet.Select(c => new Tuple <int, int>(c, Stacks.Count(s => s.IsBitSet(c)))).Where(x => x.Item2 > 0).OrderBy(x => x.Item2));

            var previousDegree = -1;

            for (int i = 0; i < Degrees.Count; i++)
            {
                var degree = Degrees[i];

                UpdateHash(ref _hashCode, degree.Item2);

                if (degree.Item2 != previousDegree)
                {
                    DegreeChangeIndices.Add(i);
                    previousDegree = degree.Item2;
                }
            }

            DegreeChangeIndices.Add(Degrees.Count);
        }