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


C# Position.captured_piece_type方法代码示例

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


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

示例1: search


//.........这里部分代码省略.........
                    nullValue = beta;

                if (depth < 12*Depth.ONE_PLY && Math.Abs(beta) < Value.VALUE_KNOWN_WIN)
                    return nullValue;

                // Do verification search at high depths
                stack.skipEarlyPruning = true;
                var v = depth - R < Depth.ONE_PLY
                    ? qsearch(NodeType.NonPV, false, pos, ss, beta - 1, beta, Depth.DEPTH_ZERO)
                    : search(NodeType.NonPV, false, pos, ss, beta - 1, beta, depth - R, false);
                stack.skipEarlyPruning = false;

                if (v >= beta)
                    return nullValue;
            }
        }

        // Step 9. ProbCut (skipped when in check)
        // If we have a very good capture (i.e. SEE > seeValues[captured_piece_type])
        // and a reduced search returns a value much above beta, we can (almost) safely
        // prune the previous move.
        if (!PvNode
            && depth >= 5*Depth.ONE_PLY_C
            && Math.Abs(beta) < Value.VALUE_MATE_IN_MAX_PLY)
        {
            var rbeta = Value.Create(Math.Min(beta + 200, Value.VALUE_INFINITE));
            var rdepth = depth - 4*Depth.ONE_PLY;

            Debug.Assert(rdepth >= Depth.ONE_PLY_C);
            Debug.Assert(stackMinus1.currentMove != Move.MOVE_NONE);
            Debug.Assert(stackMinus1.currentMove != Move.MOVE_NULL);

            var mp2 = new MovePicker(pos, ttMove, History, CounterMovesHistory,
                Value.PieceValue[(int) Phase.MG][pos.captured_piece_type()]);
            var ci2 = new CheckInfo(pos);

            while ((move = mp2.next_move(false)) != Move.MOVE_NONE)
                if (pos.legal(move, ci2.pinned))
                {
                    stack.currentMove = move;
                    pos.do_move(move, st, pos.gives_check(move, ci2));
                    value =
                        -search(NodeType.NonPV, false, pos, new StackArrayWrapper(ss.table, ss.current + 1), -rbeta,
                            -rbeta + 1, rdepth, !cutNode);
                    pos.undo_move(move);
                    if (value >= rbeta)
                        return value;
                }
        }

        // Step 10. Internal iterative deepening (skipped when in check)
        if (depth >= (PvNode ? 5*Depth.ONE_PLY_C : 8*Depth.ONE_PLY_C)
            && ttMove == 0
            && (PvNode || stack.staticEval + 256 >= beta))
        {
            var d = depth - 2*Depth.ONE_PLY - (PvNode ? Depth.DEPTH_ZERO : depth/4);
            stack.skipEarlyPruning = true;
            search(PvNode ? NodeType.PV : NodeType.NonPV, false, pos, ss, alpha, beta, d, true);
            stack.skipEarlyPruning = false;

            tte = TranspositionTable.probe(posKey, out ttHit);
            ttMove = ttHit ? tte.move() : Move.MOVE_NONE;
        }

 moves_loop: // When in check and at SpNode search starts from here
开发者ID:torfranz,项目名称:NetFish,代码行数:66,代码来源:Search.cs

示例2: update_stats

    // update_stats() updates killers, history, countermove history and
    // countermoves stats for a quiet best move.

    private static void update_stats(Position pos, StackArrayWrapper ss, MoveT move,
        Depth depth, MoveT[] quiets, int quietsCnt)
    {
        if (ss[ss.current].killers0 != move)
        {
            ss[ss.current].killers1 = ss[ss.current].killers0;
            ss[ss.current].killers0 = move;
        }

        var bonus = Value.Create((depth/Depth.ONE_PLY)*(depth/Depth.ONE_PLY));

        var prevSq = Move.to_sq(ss[ss.current - 1].currentMove);
        var cmh = CounterMovesHistory.table[pos.piece_on(prevSq), prevSq];

        History.updateH(pos.moved_piece(move), Move.to_sq(move), bonus);

        if (Move.is_ok(ss[ss.current - 1].currentMove))
        {
            Countermoves.update(pos.piece_on(prevSq), prevSq, move);
            cmh.updateCMH(pos.moved_piece(move), Move.to_sq(move), bonus);
        }

        // Decrease all the other played quiet moves
        for (var i = 0; i < quietsCnt; ++i)
        {
            History.updateH(pos.moved_piece(quiets[i]), Move.to_sq(quiets[i]), -bonus);

            if (Move.is_ok(ss[ss.current - 1].currentMove))
                cmh.updateCMH(pos.moved_piece(quiets[i]), Move.to_sq(quiets[i]), -bonus);
        }

        // Extra penalty for PV move in previous ply when it gets refuted
        if (Move.is_ok(ss[ss.current - 2].currentMove) && ss[ss.current - 1].moveCount == 1 &&
            pos.captured_piece_type()==0)
        {
            var prevPrevSq = Move.to_sq(ss[ss.current - 2].currentMove);
            var ttMoveCmh = CounterMovesHistory.table[pos.piece_on(prevPrevSq), prevPrevSq];
            ttMoveCmh.updateCMH(pos.piece_on(prevSq), prevSq, -bonus - 2*depth/Depth.ONE_PLY - 1);
        }
    }
开发者ID:torfranz,项目名称:NetFish,代码行数:43,代码来源:Search.cs


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