Exemple #1
0
        protected Boolean probeXPM(Depth wDepth, Eval mAlpha, Eval mBeta, Move moveExcluded, List <GoodMove> goodMoves)
        {
#if XPMCompositionHash
            var    bWTM      = WTM();
            UInt32 wPly      = State.MovePly;
            var    nSide     = bWTM ? 0 : 1;
            var    uMemoHash = compositionHash(bWTM);
            var    qDynamic  = (Hashcode)(uMemoHash * wPly + nSide);
#else
            var qDynamic = DynamicHash(moveExcluded);
#endif
#if XPHash128
            var match = new PositionMove(qDynamic, HashPawn, State.MovePly, wDepth);
#else
            var match = new PositionMove(qDynamic, State.MovePly, wDepth);
#endif
            var matches = new List <PositionMove>();
            State.XPMTank.Load(match, matches);
            var bFound = matches.Count > 0;

            foreach (var found in matches)
            {
                var moveFound   = adjustEmptyMove(found.BestMove);
                var etFound     = found.Type;
                var mValueFound = found.Value;
                traceVal("probeXPM", mValueFound, etFound); //[Conditional]
                var mValue = addMove(moveFound, goodMoves, wDepth, mValueFound, mAlpha, mBeta, etFound);
            }

            return(bFound);
        }
        private Point GetDeltaMove()
        {
            Point CurrentPosition = Mouse.GetPosition(this.Canvas);
            Point result          = new Point();

            if (!PositionMove.IsClear())
            {
                result = CurrentPosition.Subtraction(PositionMove);
            }

            PositionMove = CurrentPosition;
            return(result);
        }
Exemple #3
0
        protected Eval storeXPM(Depth wDepth, Eval mValue, EvalType et,
                                Move moveBest     = Move.Undefined,
                                Move moveExcluded = Move.Undefined)     // 10 MHz
        {
            Trace.Assert(EvalUndefined < mValue, "storeXPM(EvalUndefined)");
            traceVal("storeXPM", mValue, et); //[Conditional]
            State.IncEvalType(et);
#if XPMCompositionHash || DebugMoveColor
            var bWTM = WTM();
#endif
#if XPMCompositionHash
            UInt32 wPly      = State.MovePly;
            var    nSide     = bWTM ? 0 : 1;
            var    uMemoHash = compositionHash(bWTM);
            var    qDynamic  = (Hashcode)(uMemoHash * wPly + nSide);
#else
            var qDynamic = DynamicHash(moveExcluded);
#endif
            var mAdjusted = creditMate(mValue, SearchPly);

            if (IsFinal())
            {
                Trace.Assert(!isDefined(moveBest), "moveBest defined in a Final position.");
                moveBest = Move.EmptyMove;
            }
#if DebugMoveColor
            if (isDefinite(moveBest))
            {
                var bWhiteMove = (moveBest & Move.WTM) != 0;
                if (bWTM != bWhiteMove)
                {
                    Debug.Assert(bWTM == bWhiteMove, "WTM != WhiteMove [storeXPM]");
                    DisplayCurrent("storeXPM()");
                }
            }
#endif
#if XPHash128
            var store = new PositionMove(qDynamic, HashPawn, State.MovePly, wDepth,
                                         mAdjusted, et, moveBest);
#else
            var store = new PositionMove(qDynamic, State.MovePly, wDepth,
                                         mAdjusted, et, moveBest);
#endif
            State.XPMTank.Save(store);
            return(mValue);
        }
 private void OnEventMouseUp(MouseButtonEventArgs e)
 {
     this.ReleaseMouseCapture();
     PositionMove.Clear();
     Keyboard.Focus(this);
 }