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
This commit is contained in:
Calcitem 2021-05-21 01:55:33 +08:00
parent 14a2dbc955
commit fd2a52f724
1 changed files with 8 additions and 4 deletions

View File

@ -425,7 +425,15 @@ void move_priority_list_shuffle()
Depth get_search_depth(const Position *pos)
{
const int pb = pos->count<ON_BOARD>(WHITE);
const int pw = pos->count<ON_BOARD>(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<ON_BOARD>(WHITE);
const int pw = pos->count<ON_BOARD>(BLACK);
const int pieces = pb + pw;
int diff = pb - pw;
if (diff < 0) {