From 02380b64bd4ad7f268cac22967f7e5cbf12243ad Mon Sep 17 00:00:00 2001 From: Calcitem Date: Mon, 4 May 2020 15:02:19 +0800 Subject: [PATCH] =?UTF-8?q?pvs:=20PVS=20=E7=9B=B8=E5=85=B3=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=A8=E5=AE=8F=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/config.h | 1 + src/ai/search.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/config.h b/include/config.h index d861866d..6737ab13 100644 --- a/include/config.h +++ b/include/config.h @@ -35,6 +35,7 @@ //#define UCT_DEMO #define ALPHABETA_AI +#define PVS_AI //#define MTDF_AI //#define MCTS_AI diff --git a/src/ai/search.cpp b/src/ai/search.cpp index e2b54efe..bfa1cfa9 100644 --- a/src/ai/search.cpp +++ b/src/ai/search.cpp @@ -994,12 +994,13 @@ value_t AIAlgorithm::search(depth_t depth, value_t alpha, value_t beta, Node *no epsilon = 0; } +#ifdef PVS_AI if (i == 0) { if (after != before) { value = -search(depth - 1 + epsilon, -beta, -alpha, node->children[0]); } else { value = search(depth - 1 + epsilon, alpha, beta, node->children[0]); - } + } } else { if (after != before) { value = -search(depth - 1 + epsilon, -alpha - 1, -alpha, node->children[i]); @@ -1017,6 +1018,13 @@ value_t AIAlgorithm::search(depth_t depth, value_t alpha, value_t beta, Node *no } } } +#else + if (after != before) { + value = -search(depth - 1 + epsilon, -beta, -alpha, node->children[i]); + } else { + value = search(depth - 1 + epsilon, alpha, beta, node->children[i]); + } +#endif // PVS_AI undoMove();