当前位置: 首页>>代码示例>>C#>>正文


C# Position.advanced_pawn_push方法代码示例

本文整理汇总了C#中Position.advanced_pawn_push方法的典型用法代码示例。如果您正苦于以下问题:C# Position.advanced_pawn_push方法的具体用法?C# Position.advanced_pawn_push怎么用?C# Position.advanced_pawn_push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Position的用法示例。


在下文中一共展示了Position.advanced_pawn_push方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: search


//.........这里部分代码省略.........
            // Step 12. Extend checks
            if (givesCheck && pos.see_sign(move) >= Value.VALUE_ZERO)
                extension = Depth.ONE_PLY;

            // Singular extension search. If all moves but one fail low on a search of
            // (alpha-s, beta-s), and just one fails high on (alpha, beta), then that move
            // is singular and should be extended. To verify this we do a reduced search
            // on all the other moves but the ttMove and if the result is lower than
            // ttValue minus a margin then we extend the ttMove.
            if (singularExtensionNode
                && move == ttMove
                && extension == 0
                && pos.legal(move, ci.pinned))
            {
                var rBeta = ttValue - 2*depth/Depth.ONE_PLY;
                stack.excludedMove = move;
                stack.skipEarlyPruning = true;
                value = search(NodeType.NonPV, false, pos, ss, rBeta - 1, rBeta, depth/2, cutNode);
                stack.skipEarlyPruning = false;
                stack.excludedMove = Move.MOVE_NONE;

                if (value < rBeta)
                    extension = Depth.ONE_PLY;
            }

            // Update the current move (this must be done after singular extension search)
            var newDepth = depth - Depth.ONE_PLY + extension;

            // Step 13. Pruning at shallow depth
            if (!RootNode
                && !captureOrPromotion
                && !inCheck
                && !givesCheck
                && !pos.advanced_pawn_push(move)
                && bestValue > Value.VALUE_MATED_IN_MAX_PLY)
            {
                // Move count based pruning
                if (depth < 16*Depth.ONE_PLY
                    && moveCount >= FutilityMoveCounts[improving ? 1 : 0, depth])
                {
                    if (SpNode)
                        ThreadHelper.lock_grab(splitPoint.spinLock);

                    continue;
                }

                var predictedDepth = newDepth - reduction(PvNode, improving, depth, moveCount);

                // Futility pruning: parent node
                if (predictedDepth < 7*Depth.ONE_PLY)
                {
                    var futilityValue = stack.staticEval + futility_margin(predictedDepth) + 256;

                    if (futilityValue <= alpha)
                    {
                        bestValue = Value.Create(Math.Max(bestValue, futilityValue));

                        if (SpNode)
                        {
                            ThreadHelper.lock_grab(splitPoint.spinLock);
                            if (bestValue > splitPoint.bestValue)
                                splitPoint.bestValue = bestValue;
                        }
                        continue;
                    }
                }
开发者ID:torfranz,项目名称:NetFish,代码行数:67,代码来源:Search.cs

示例2: qsearch


//.........这里部分代码省略.........

                return bestValue;
            }

            if (PvNode && bestValue > alpha)
                alpha = bestValue;

            futilityBase = bestValue + 128;
        }

        // Initialize a MovePicker object for the current position, and prepare
        // to search the moves. Because the depth is <= 0 here, only captures,
        // queen promotions and checks (only if depth >= DEPTH_QS_CHECKS) will
        // be generated.
        var mp = new MovePicker(pos, ttMove, depth, History, CounterMovesHistory,
            Move.to_sq(previousStack.currentMove));
        var ci = new CheckInfo(pos);

        // Loop through the moves until no moves remain or a beta cutoff occurs
        MoveT move;
        MoveT bestMove = Move.MOVE_NONE;
        while ((move = mp.next_move(false)) != Move.MOVE_NONE)
        {
            Debug.Assert(Move.is_ok(move));

            var givesCheck = Move.type_of(move) == MoveType.NORMAL && ci.dcCandidates == 0
                ? Bitboard.AndWithSquare(ci.checkSquares[Piece.type_of(pos.piece_on(Move.from_sq(move)))], Move.to_sq(move))!=0
                : pos.gives_check(move, ci);

            // Futility pruning
            if (!InCheck
                && !givesCheck
                && futilityBase > -Value.VALUE_KNOWN_WIN
                && !pos.advanced_pawn_push(move))
            {
                Debug.Assert(Move.type_of(move) != MoveType.ENPASSANT); // Due to !pos.advanced_pawn_push

                var futilityValue = futilityBase + Value.PieceValue[(int) Phase.EG][pos.piece_on(Move.to_sq(move))];

                if (futilityValue <= alpha)
                {
                    bestValue = Value.Create(Math.Max(bestValue, futilityValue));
                    continue;
                }

                if (futilityBase <= alpha && pos.see(move) <= Value.VALUE_ZERO)
                {
                    bestValue = Value.Create(Math.Max(bestValue, futilityBase));
                    continue;
                }
            }

            // Detect non-capture evasions that are candidates to be pruned
            var evasionPrunable = InCheck
                                   && bestValue > Value.VALUE_MATED_IN_MAX_PLY
                                   && !pos.capture(move);

            // Don't search moves with negative SEE values
            if ((!InCheck || evasionPrunable)
                && Move.type_of(move) != MoveType.PROMOTION
                && pos.see_sign(move) < Value.VALUE_ZERO)
                continue;

            // Speculative prefetch as early as possible
            //prefetch(TT.first_entry(pos.key_after(move)));
开发者ID:torfranz,项目名称:NetFish,代码行数:66,代码来源:Search.cs


注:本文中的Position.advanced_pawn_push方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。