/// <summary>In case of collision overwrites replace the eldest keep pv nodes</summary>
        public override void Set(Board board, int nodeType, int bestMove, int score, byte
			 depthAnalyzed, bool exclusion)
        {
            long key2 = board.GetKey2();
            int startIndex = (int)((long)(((ulong)(exclusion ? board.GetExclusionKey() : board
                .GetKey())) >> (64 - sizeBits)));
            // Verifies that is really this board
            int oldGenerationIndex = -1;
            // first index of an old generation entry
            int notPvIndex = -1;
            // first index of an not PV entry
            index = -1;
            for (int i = startIndex; i < startIndex + MAX_PROBES && i < size; i++)
            {
                info = infos[i];
                // TODO do not replace PVs
                //if (keys[i] == 0 || (keys[i] == key2 && (getGeneration() != generation || getDepthAnalyzed() <= depthAnalyzed))) {
                if (keys[i] == 0 || (keys[i] == key2))
                {
                    index = i;
                    break;
                }
                if (oldGenerationIndex == -1 && GetGeneration() != generation)
                {
                    oldGenerationIndex = i;
                }
                if (notPvIndex == -1 && GetNodeType() != TYPE_EXACT_SCORE)
                {
                    notPvIndex = i;
                }
            }
            if (index == -1 && oldGenerationIndex != -1)
            {
                index = oldGenerationIndex;
            }
            if (index == -1 && notPvIndex != -1)
            {
                index = notPvIndex;
            }
            if (index == -1)
            {
                return;
            }
            // Do not overwrite unless a PV node
            //			if (nodeType != TYPE_EXACT_SCORE) return;
            //			index = startIndex;
            keys[index] = key2;
            info = (bestMove & unchecked((int)(0x1fffff))) | ((nodeType & unchecked((int)(0xf
                ))) << 21) | (((long)(generation & unchecked((int)(0xff)))) << 32) | (((long)(depthAnalyzed
                 & unchecked((int)(0xff)))) << 40) | (((long)(score & unchecked((int)(0xffff))))
                 << 48);
            infos[index] = info;
        }
 public override bool Search(Board board, bool exclusion)
 {
     info = 0;
     int startIndex = (int)((long)(((ulong)(exclusion ? board.GetExclusionKey() : board
         .GetKey())) >> (64 - sizeBits)));
     // Verifies that is really this board
     for (index = startIndex; index < startIndex + MAX_PROBES && index < size; index++)
     {
         if (keys[index] == board.GetKey2())
         {
             info = infos[index];
             return true;
         }
     }
     return false;
 }
 /// <summary>Returns true if key matches with key stored</summary>
 public override bool Search(Board board, bool exclusion)
 {
     info = 0;
     index = (int)((long)(((ulong)(exclusion ? board.GetExclusionKey() : board.GetKey(
         ))) >> (64 - sizeBits))) & ~unchecked((int)(0x01));
     // Get the first odd index
     long key2 = board.GetKey2();
     // Verifies that is really this board
     if (keys[index] == key2 || keys[++index] == key2)
     {
         // Already returns the correct index
         info = infos[index];
         return true;
     }
     return false;
 }
        public override void Set(Board board, int nodeType, int bestMove, int score, byte
			 depthAnalyzed, bool exclusion)
        {
            long key2 = board.GetKey2();
            index = (int)((long)(((ulong)(exclusion ? board.GetExclusionKey() : board.GetKey(
                ))) >> (64 - sizeBits))) & ~unchecked((int)(0x01));
            // Get the first odd index
            info = infos[index];
            if (keys[index] == 0 || ((sbyte)GetDepthAnalyzed()) <= depthAnalyzed || GetGeneration
                () != generation)
            {
            }
            else
            {
                // Replace odd entry
                // Replace even entry
                index++;
            }
            keys[index] = key2;
            info = (bestMove & unchecked((int)(0x1fffff))) | ((nodeType & unchecked((int)(0xf
                ))) << 21) | (((long)(generation & unchecked((int)(0xff)))) << 32) | (((long)(depthAnalyzed
                 & unchecked((int)(0xff)))) << 40) | (((long)(score & unchecked((int)(0xffff))))
                 << 48);
            infos[index] = info;
        }
        /// <summary>In case of collision overwrites replace the eldest keep pv nodes</summary>
        public override void Set(Board board, int nodeType, int bestMove, int score, byte
			 depthAnalyzed, bool exclusion)
        {
            long key2 = board.GetKey2();
            int startIndex = (int)((long)(((ulong)(exclusion ? board.GetExclusionKey() : board
                .GetKey())) >> (64 - sizeBits))) & ~unchecked((int)(0x03));
            // Verifies that is really this board
            index = -1;
            for (int i = startIndex; i < startIndex + MAX_PROBES; i++)
            {
                info = infos[i];
                if (keys[i] == 0 || (keys[i] == key2))
                {
                    // Empty or replace
                    if (keys[i] != 0 && GetGeneration() == generation && (depthAnalyzed == 0 || GetDepthAnalyzed
                        () > depthAnalyzed))
                    {
                        // When
                        // replacing
                        // something
                        // my
                        // generation
                        // || (getDepthAnalyzed() == depthAnalyzed &&
                        // getNodeType() == TYPE_EXACT_SCORE && nodeType !=
                        // TYPE_EXACT_SCORE)
                        return;
                    }
                    // Never replace with eval values or lower depth or
                    // exact scores with other nodetypes
                    index = i;
                    if (keys[i] == key2 && bestMove == 0)
                    {
                        bestMove = GetBestMove();
                    }
                    // Keep best move when replacing
                    // and no move
                    break;
                }
                if (GetGeneration() != generation || ((sbyte)GetDepthAnalyzed()) < depthAnalyzed)
                {
                    // TODO
                    // <
                    // or
                    // >=
                    // ?
                    index = i;
                    break;
                }
            }
            if (index == -1)
            {
                return;
            }
            // No slot found
            keys[index] = key2;
            info = (bestMove & unchecked((int)(0x1fffff))) | ((nodeType & unchecked((int)(0xf
                ))) << 21) | (((long)(generation & unchecked((int)(0xff)))) << 32) | (((long)(depthAnalyzed
                 & unchecked((int)(0xff)))) << 40) | (((long)(score & unchecked((int)(0xffff))))
                 << 48);
            infos[index] = info;
        }