當前位置: 首頁>>代碼示例>>C#>>正文


C# Position.is_pseudo_legal方法代碼示例

本文整理匯總了C#中Portfish.Position.is_pseudo_legal方法的典型用法代碼示例。如果您正苦於以下問題:C# Position.is_pseudo_legal方法的具體用法?C# Position.is_pseudo_legal怎麽用?C# Position.is_pseudo_legal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Portfish.Position的用法示例。


在下文中一共展示了Position.is_pseudo_legal方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: extract_pv_from_tt

        /// RootMove::extract_pv_from_tt() builds a PV by adding moves from the TT table.
        /// We consider also failing high nodes and not only BOUND_EXACT nodes so to
        /// allow to always have a ponder move even when we fail high at root, and a
        /// long PV to print that is important for position analysis.
        internal void extract_pv_from_tt(Position pos)
        {
            StateInfoArray sia = StateInfoArrayBroker.GetObject();

            int stPos = 0;
            TTEntry tte;
            int ply = 1;
            Move m = pv[0];

            Debug.Assert(m != MoveC.MOVE_NONE && pos.is_pseudo_legal(m));

            pv.Clear();
            pv.Add(m);
            pos.do_move(m, sia.state[stPos++]);

            UInt32 ttePos = 0;

            while (TT.probe(pos.key(), ref ttePos, out tte)
               && (m = tte.move()) != MoveC.MOVE_NONE // Local copy, TT entry could change
               && pos.is_pseudo_legal(m)
               && pos.pl_move_is_legal(m, pos.pinned_pieces())
               && ply < Constants.MAX_PLY
               && (!pos.is_draw(false) || ply < 2))
            {
                pv.Add(m);
                pos.do_move(m, sia.state[stPos++]);
                ply++;
            }
            pv.Add(MoveC.MOVE_NONE);

            do pos.undo_move(pv[--ply]); while (ply != 0);

            StateInfoArrayBroker.Free();
        }
開發者ID:stevemulligan,項目名稱:Portfish,代碼行數:38,代碼來源:Search.cs

示例2: insert_pv_in_tt

        // insert_pv_in_tt() is called at the end of a search iteration, and inserts
        // the PV back into the TT. This makes sure the old PV moves are searched
        // first, even if the old TT entries have been overwritten.
        internal void insert_pv_in_tt(Position pos)
        {
            StateInfoArray sia = StateInfoArrayBroker.GetObject();

            int stPos = 0;
            TTEntry tte;
            bool tteHasValue;
            Key k;
            Value v, m = ValueC.VALUE_NONE;
            int ply = 0;
            UInt32 ttePos = 0;

            Debug.Assert(pv[ply] != MoveC.MOVE_NONE && pos.is_pseudo_legal(pv[ply]));

            do
            {
                k = pos.key();
                tteHasValue = TT.probe(k, ref ttePos, out tte);

                // Don't overwrite existing correct entries
                if ((!tteHasValue) || tte.move() != pv[ply])
                {
                    v = (pos.in_check() ? ValueC.VALUE_NONE : Evaluate.do_evaluate(false, pos, ref m));
                    TT.store(k, ValueC.VALUE_NONE, Bound.BOUND_NONE, DepthC.DEPTH_NONE, pv[ply], v, m);
                }
                pos.do_move(pv[ply], sia.state[stPos++]);
            } while (pv[++ply] != MoveC.MOVE_NONE);

            do pos.undo_move(pv[--ply]); while (ply != 0);

            StateInfoArrayBroker.Free();
        }
開發者ID:stevemulligan,項目名稱:Portfish,代碼行數:35,代碼來源:Search.cs

示例3: MovePickerC

        internal void MovePickerC(Position p, Move ttm, History h, PieceType pt)
        {
            pos = p;
            H = h;
            curMovePos = 0;
            lastMovePos = 0;

            Debug.Assert(!pos.in_check());

            depth = 0;
            ttMove = 0;
            lastQuietPos = 0; lastBadCapturePos = 0;
            mpos = 0;

            phase = SequencerC.PROBCUT;

            // In ProbCut we generate only captures better than parent's captured piece
            captureThreshold = Position.PieceValueMidgame[pt];
            ttMove = ((ttm != 0) && pos.is_pseudo_legal(ttm) ? ttm : MoveC.MOVE_NONE);

            if ((ttMove != 0) && (!pos.is_capture(ttMove) || pos.see(ttMove, false) <= captureThreshold))
                ttMove = MoveC.MOVE_NONE;

            lastMovePos += ((ttMove != MoveC.MOVE_NONE) ? 1 : 0);
        }
開發者ID:CVChrisWilson,項目名稱:Portfish,代碼行數:25,代碼來源:MovePicker.cs

示例4: extract_pv_from_tt

        /// RootMove::extract_pv_from_tt() builds a PV by adding moves from the TT table.
        /// We consider also failing high nodes and not only BOUND_EXACT nodes so to
        /// allow to always have a ponder move even when we fail high at root, and a
        /// long PV to print that is important for position analysis.
        internal void extract_pv_from_tt(Position pos)
        {
            var sia = StateInfoArrayBroker.GetObject();

            var stPos = 0;
            TTEntry tte;
            bool tteHasValue;
            var ply = 0;
            var m = this.pv[0];

            this.pv.Clear();
            
            uint ttePos = 0;
            do
            {
                this.pv.Add(m);

                Debug.Assert(pos.move_is_legal(pv[ply]));
                pos.do_move(pv[ply++], sia.state[stPos++]);
                tteHasValue = TT.probe(pos.key(), ref ttePos, out tte);
            } while (tteHasValue
                    && pos.is_pseudo_legal(m = tte.move()) // Local copy, TT could change
                    && pos.pl_move_is_legal(m, pos.pinned_pieces())
                    && ply < Constants.MAX_PLY
                    && (!pos.is_draw(false) || ply < 2));
            ;
            
            this.pv.Add(MoveC.MOVE_NONE); // Must be zero-terminating

            while (ply != 0)
            {
                pos.undo_move(this.pv[--ply]);
            }

            StateInfoArrayBroker.Free();
        }
開發者ID:torfranz,項目名稱:Portfish,代碼行數:40,代碼來源:Search.cs


注:本文中的Portfish.Position.is_pseudo_legal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。