If you do not have any PST's, then where do you know where to put your pieces? Every position where material is equal will actually be considered equal, but that is of course not true.

With regard to testing QSearch: you can do this with a fixed ply of one. Set up a very simple position such as this:

[d] 4r1k1/4nppp/2b5/1r2N3/5P2/3Q4/6PP/5RK1 w - - 0 1

Then set the depth to 1 and do a one-ply search. The engine will probably go for Qd3xb5, because that is the largest possible gain. If you implement QSearch correctly, the engine won't play that move, even on depth 1, because it will see that it will lose the Queen. If QSearch is working correctly, the engine should see, even on depth 1, that the correct move is Ne5xc6, because it removes the bishop defending Rb5. If black recaptures, the queen captures the Rook.

Rustic, depth 1 search:

Code: Select all

```
board
8 . . . . r . k .
7 . . . . n i i i
6 . . b . . . . .
5 . r . . N . . .
4 . . . . . I . .
3 . . . Q . . . .
2 . . . . . . I I
1 . . . . . R K .
A B C D E F G H
Zobrist key: 543ca32189ca3dfe
Active Color: White
Castling: -
En Passant: -
Half-move clock: 0
Full-move number: 1
go depth 1
info score cp 420 depth 1 seldepth 5 time 0 nodes 10 nps 0 pv e5c6
bestmove e5c6
```

However, the best move for black is to not recapture after Nxc6, because it will then only lose a bishop instead of a rook.

Depth 2:

Code: Select all

```
go depth 2
info score cp 420 depth 1 seldepth 5 time 0 nodes 10 nps 0 pv e5c6
info score cp 405 depth 2 seldepth 6 time 0 nodes 139 nps 0 pv e5c6 b5b2
```

As you can see, black moves the Rook away. What it can not see using QSearch is that white can now capture Nxe7+, because if black recaptures with the Rook Re8xe7, he will be mated on the back rank with Qd5d8+. You need more search depth for that. After Nxc6 Rb2 Nxe7 Rxe7 the position is quiet, and it's the best position black can see on depth 2.

It can't yet see it at depth 3, but at depth 4, it sees that covering the knight on e7 (with Rb5b7) to not lose more material is essential:

go depth 3

info score cp 420 depth 1 seldepth 5 time 0 nodes 10 nps 0 pv e5c6

info score cp 405 depth 2 seldepth 6 time 0 nodes 139 nps 0 pv e5c6 b5b2

info score cp 420 depth 3 seldepth 6 time 0 nodes 571 nps 0 pv e5c6 b5c5 c6d4

go depth 4

info score cp 420 depth 1 seldepth 5 time 0 nodes 10 nps 0 pv e5c6

info score cp 405 depth 2 seldepth 6 time 0 nodes 139 nps 0 pv e5c6 b5b2

info score cp 420 depth 3 seldepth 6 time 0 nodes 571 nps 0 pv e5c6 b5c5 c6d4

info score cp 445 depth 4 seldepth 10 time 1 nodes 4897 nps 4897000 pv e5c6 b5b7 d3e4 b7c7

When doing a full search, you can see how far QSearch (and check extension) actually extends (in the seldepth parameter):

Code: Select all

```
info score cp 420 depth 1 seldepth 5 time 0 nodes 10 nps 0 pv e5c6
info score cp 405 depth 2 seldepth 6 time 0 nodes 139 nps 0 pv e5c6 b5b2
info score cp 420 depth 3 seldepth 6 time 0 nodes 571 nps 0 pv e5c6 b5c5 c6d4
info score cp 445 depth 4 seldepth 10 time 1 nodes 4897 nps 4897000 pv e5c6 b5b7 d3e4 b7c7
info score cp 445 depth 5 seldepth 11 time 7 nodes 19523 nps 2789000 pv e5c6 b5b7 d3e4 b7c7 c6d4
info score cp 445 depth 6 seldepth 14 time 43 nodes 171114 nps 3979395 pv e5c6 b5b7 d3e4 b7c7 c6d4 c7c3
info score cp 445 depth 7 seldepth 16 time 226 nodes 700354 nps 3098912 pv e5c6 b5b7 f1e1 b7c7 c6d4 c7c5 d3e4
info score cp 475 depth 8 seldepth 18 time 1458 nodes 5656060 nps 3879328 pv e5c6 b5b7 f1e1 f7f6 d3e4 g8f8 f4f5 f8f7
info score cp 615 depth 9 seldepth 20 time 7543 nodes 26768146 nps 3548740 pv e5c6 b5b7 f1e1 f7f5 c6d8 b7b4 d3d5 g8h8 d5d7 e8d8 d7d8
info score cp 610 depth 10 seldepth 22 time 45987 nodes 173177588 nps 3765794 pv e5c6 b5b7 f1e1 f7f5 c6d8 b7b4 d3d5 g8h8 d5d7 e8d8 d7d8 e7g8
```

With regard to the position you provided, Rustic sees that black will end up in the negative. The negative becomes larger as it searches deeper (hopefully it'll be able to go deeper this weekend):

Code: Select all

```
go
info score cp 10 depth 1 seldepth 5 time 0 nodes 55 nps 0 pv b7b6
info score cp -10 depth 2 seldepth 12 time 0 nodes 936 nps 0 pv b7c7 g2g1
info score cp -35 depth 3 seldepth 13 time 3 nodes 20333 nps 6777667 pv f8e8 e3g5 g8f8 g2g1
info score cp -40 depth 4 seldepth 19 time 32 nodes 155622 nps 4863188 pv f8e8 e3g5 g8f8 g5f6 e8e7
info score cp -135 depth 5 seldepth 20 time 178 nodes 761646 nps 4278910 pv f8c8 e3g5 g8f8 g5f6 f8g8 c4f7 g8h7
info score cp -135 depth 6 seldepth 22 time 2151 nodes 6929962 nps 3221740 pv f5f4 e3f4 b4e7 f4e4 e7f6 a4a2
info score cp -230 depth 7 seldepth 25 time 32941 nodes 100337476 nps 3045975 pv f5f4 e3e5 b4e7 f1h1 e7f6 e5f6 f4g3 f2g3 b7b2
```