Skip to content

Commit

Permalink
depth: Fix to depth 1 when searching first 2 moves
Browse files Browse the repository at this point in the history
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
  • Loading branch information
calcitem committed May 20, 2021
1 parent 14a2dbc commit fd2a52f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/mills.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit fd2a52f

Please sign in to comment.