Example #1
0
        public bool TryGetValue(ulong StateKey, out PvTableValue value)
        {
            ulong key = StateKey % MaxEntries;

            value = values[key];
            if (value == null || value.StateKey != StateKey)
            {
                value = null;
                return(false);
            }
            return(true);
        }
Example #2
0
        public void StoreHashEntry(Board board, Move move, int score, int depth)
        {
            if (score > Constants.IsMate)
            {
                score += board.Ply;
            }
            else if (score < -Constants.IsMate)
            {
                score -= board.Ply;
            }

            ulong key = board.StateKey % MaxEntries;

            values[key] = new PvTableValue()
            {
                Move = move, Score = score, Depth = depth, StateKey = board.StateKey
            };
        }