From fd2a52f7244d9704e51fa6e07a64fd5f3dcde431 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Fri, 21 May 2021 01:55:33 +0800 Subject: [PATCH] depth: Fix to depth 1 when searching first 2 moves In order to consider only position instead of material. Case: Human AI 1. d6 f4 2. b4 g4 3. e4 f6 4. f2 d2?? 5. d3 d7 6. e3 e5 7. c4 a4 8. c3xa4 a4 9. c5xd2 g7 10. d3-d2 a4-a7xd2 11. c5-d5 a7-a4 12. d5-c5xg7 a4-a7 13. b4-b2 g4-g7xf2 14. c4-b4 e5-d5 15. b2-d2 a7-a4 16. d2-d3xd7 g7-g4 17. e4-e5 a4-a7 18. e3-e4 a7-d7 19. d3-e3xf6 g4-g1 20. e3-d3 g1-d1 21. b4-c4xd5 d7-d5 22. e4-e3xf4 The computer loses as early as move 3. It is a theoretical loss according to the online database. Thanks @Matt --- src/mills.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mills.cpp b/src/mills.cpp index 3c1eda35..485c795b 100644 --- a/src/mills.cpp +++ b/src/mills.cpp @@ -425,7 +425,15 @@ void move_priority_list_shuffle() Depth get_search_depth(const Position *pos) { + const int pb = pos->count(WHITE); + const int pw = pos->count(BLACK); + + const int pieces = pb + pw; + if (!gameOptions.getDeveloperMode()) { + if (pos->phase == Phase::placing && pieces <= 4) { + return 1; + } return (Depth)gameOptions.getSkillLevel(); } @@ -508,10 +516,6 @@ Depth get_search_depth(const Position *pos) } if (pos->phase == Phase::moving) { - const int pb = pos->count(WHITE); - const int pw = pos->count(BLACK); - - const int pieces = pb + pw; int diff = pb - pw; if (diff < 0) {