depth: 飞棋的深度固定为9且如果双方都进入飞子阶段则深度再减半

This commit is contained in:
Calcitem 2020-07-14 01:52:44 +08:00
parent ab716466dd
commit 4961c0cafe
1 changed files with 17 additions and 0 deletions

View File

@ -117,6 +117,8 @@ Depth AIAlgorithm::changeDepth()
}; };
#endif /* ENDGAME_LEARNING */ #endif /* ENDGAME_LEARNING */
const Depth flyingDepth = 9;
if (pos->phase & PHASE_PLACING) { if (pos->phase & PHASE_PLACING) {
if (rule.nTotalPiecesEachSide == 12) { if (rule.nTotalPiecesEachSide == 12) {
d = placingDepthTable_12[rule.nTotalPiecesEachSide * 2 - pos->getPiecesInHandCount(BLACK) - pos->getPiecesInHandCount(WHITE)]; d = placingDepthTable_12[rule.nTotalPiecesEachSide * 2 - pos->getPiecesInHandCount(BLACK) - pos->getPiecesInHandCount(WHITE)];
@ -141,6 +143,19 @@ Depth AIAlgorithm::changeDepth()
if (d == 0) { if (d == 0) {
d = movingDepthTable[pieces]; d = movingDepthTable[pieces];
} }
// Can fly
if (rule.allowFlyWhenRemainThreePieces) {
if (pb == rule.nPiecesAtLeast ||
pw == rule.nPiecesAtLeast) {
d = flyingDepth;
}
if (pb == rule.nPiecesAtLeast &&
pw == rule.nPiecesAtLeast) {
d = flyingDepth / 2;
}
}
} }
if (unlikely(d > reduce)) { if (unlikely(d > reduce)) {
@ -155,6 +170,8 @@ Depth AIAlgorithm::changeDepth()
d = FIX_DEPTH; d = FIX_DEPTH;
#endif #endif
assert(d <= 32);
loggerDebug("Depth: %d\n", d); loggerDebug("Depth: %d\n", d);
return d; return d;