sortLegalMoves 增加一段代码备用

目前启用后会出现打印的着法没有显示最优着法,待完善
This commit is contained in:
CalciteM 2019-07-07 20:43:43 +08:00
parent e8ee553d50
commit 96e9ae565f
1 changed files with 31 additions and 2 deletions

View File

@ -251,10 +251,39 @@ void NineChessAi_ab::sortLegalMoves(Node *node)
#else #else
if (chessTemp.whosTurn() == NineChess::PLAYER1) { if (chessTemp.whosTurn() == NineChess::PLAYER1) {
node->children.sort([](Node* n1, Node* n2) {return n1->value > n2->value;}); node->children.sort([](Node *n1, Node *n2) {return n1->value > n2->value; });
} else { } else {
node->children.sort([](Node* n1, Node* n2) { return n1->value < n2->value;}); node->children.sort([](Node *n1, Node *n2) { return n1->value < n2->value; });
} }
#if 0
if (chessTemp.whosTurn() == NineChess::PLAYER1) {
node->children.sort([](Node *n1, Node *n2) {
bool ret = false;
if (n1->value > n2->value) {
ret = true;
} else if (n1->value < n2->value) {
ret = false;
} else if (n1->value == n2->value) {
ret = n1->pruned < n2->pruned;
}
return ret;
});
} else {
node->children.sort([](Node *n1, Node *n2) {
bool ret = false;
if (n1->value < n2->value) {
ret = true;
} else if (n1->value > n2->value) {
ret = false;
} else if (n1->value == n2->value) {
ret = n1->pruned > n2->pruned;
}
return ret;
});
}
#endif
#endif #endif
} }