本文整理汇总了C#中Portfish.Position.bishop_pair方法的典型用法代码示例。如果您正苦于以下问题:C# Position.bishop_pair方法的具体用法?C# Position.bishop_pair怎么用?C# Position.bishop_pair使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Portfish.Position
的用法示例。
在下文中一共展示了Position.bishop_pair方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Endgame_KXK
/// Mate with KX vs K. This function is used to evaluate positions with
/// King and plenty of material vs a lone king. It simply gives the
/// attacking side a bonus for driving the defending king towards the edge
/// of the board, and for keeping the distance between the two kings small.
/// KXK
internal static Value Endgame_KXK(Color strongerSide, Position pos)
{
Color weakerSide = strongerSide ^ 1;
Debug.Assert(pos.non_pawn_material(weakerSide) == ValueC.VALUE_ZERO);
Debug.Assert(pos.piece_count(weakerSide, PieceTypeC.PAWN) == ValueC.VALUE_ZERO);
// Stalemate detection with lone king
MList mlist = MListBroker.GetObject(); mlist.pos = 0;
Movegen.generate_legal(pos, mlist.moves, ref mlist.pos);
bool any = mlist.pos > 0;
MListBroker.Free();
if (pos.sideToMove == weakerSide
&& !pos.in_check()
&& !any)
{
return ValueC.VALUE_DRAW;
}
Square winnerKSq = pos.king_square(strongerSide);
Square loserKSq = pos.king_square(weakerSide);
Value result = pos.non_pawn_material(strongerSide)
+ pos.piece_count(strongerSide, PieceTypeC.PAWN) * Constants.PawnValueEndgame
+ MateTable[loserKSq]
+ DistanceBonus[Utils.square_distance(winnerKSq, loserKSq)];
if (pos.piece_count(strongerSide, PieceTypeC.QUEEN)!=0
|| pos.piece_count(strongerSide, PieceTypeC.ROOK)!=0
|| pos.bishop_pair(strongerSide))
{
result += ValueC.VALUE_KNOWN_WIN;
}
return strongerSide == pos.sideToMove ? result : -result;
}