Пример #1
0
 // Construction
 internal TranspositionTable()
 {
     Table = new TranspositionEntry[TABLE_SIZE];
     for (int i = 0; i < TABLE_SIZE; i++)
     {
         Table[i] = new TranspositionEntry();
     }
 }
Пример #2
0
        // bool LookupBoard( jcBoard theBoard, jcMove theMove )
        // Verify whether there is a stored evaluation for a given board.
        // If so, return TRUE and copy the appropriate values into the
        // output parameter
        internal bool TryLookupBoard(Board _board, out TranspositionEntry _entry)
        {
            // Find the board's hash position in Table
            int key = Math.Abs(_board.GetHashCode() % TABLE_SIZE);
            TranspositionEntry entry = Table[key];

            _entry = entry;
            // If the entry is an empty placeholder, we don't have a match
            if (entry.EvaluationType == EvaluationType.None)
            {
                return(false);
            }

            // Check for a hashing collision!
            if (entry.CollisionKey != _board.HashCollisionsKey())
            {
                return(false);
            }

            // Now, we know that we have a match!  Copy it into the output parameter
            // and return

            return(true);
        }