End game analysis

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

End game analysis

Post by xr_a_y »

Weini recently played this game against Asymptote

https://lichess.org/uHx7ayXd#113

and reach this position

[d] 8/5kpp/p2Pp3/Qp3p2/7q/5P2/6K1/8 b - - 1 57

From there, Weini blunder twice, first with f5f4 and just after with f7g6 going from a winning score to a losing score in two moves with initially a 4 pawn advantage on the board.

Weini took those decisions at depth 13 searches with the TC used.

The recommanded Stockfish move, h4g5+ is only found at depth 14

Code: Select all

1 568 0 108     h4g5+
2 482 0 707     h4a4 a5a4
3 513 0 2379    f5f4 a5c7+ f7g6
4 533 1 4533    f5f4 a5c7+ f7g6 c7c2+
5 537 2 6445    f5f4 a5c7+ f7g6 c7c3 h4g3+
6 545 5 15534   f5f4 a5c7+ f7g6 c7c3 h4g3+ g2f1
7 547 9 29211   f5f4 a5c7+ f7g6 c7c2+ g6f6 c2c3+ e6e5
8 541 21 58621  f5f4 a5c7+ f7g6 c7c3 h4g3+ g2f1 b5b4 c3d3+
9 514 61 180786 f5f4 a5c7+ f7g6 c7c6 h7h5 d6d7 g6f7 g2f1 h4h1+
10 531 83 243664        f5f4 a5c7+ f7g6 c7c6 h7h5 d6d7 g6f7 g2f1 b5b4 c6a6
11 505 244 659039       f5f4 a5c7+ f7g6 c7c6 h4g3+ g2f1 g6f6 d6d7 f6e7 f1e2 g3g5
12 512 309 896167       f5f4 a5c7+ f7g6 c7c6 h4g3+ g2f1 g6f6 d6d7 f6e7 f1e2 g3g5 c6a6
13 508 495 1441562      f5f4 a5c7+ f7g6 d6d7 h4g3+ g2f1 g3f3+ f1e1 f3e3+ e1d1 e3g1+ d1e2 g1h2+
14 419 15033 46804812   h4g5+ g2f2 g5f4
Asymptote passed pawn is (staticcaly) scored +60 for white, but Weini is scoring +74 is own passed pawn on a and b file (less advanced but connected ...).

Code: Select all

#INFO    - 2018-08-28 11:27:47-436: tapered coeff             1
#INFO    - 2018-08-28 11:27:47-436: material                  -485
#INFO    - 2018-08-28 11:27:47-436: don't like to be in check 0
#INFO    - 2018-08-28 11:27:47-436: Piece pair                0
#INFO    - 2018-08-28 11:27:47-436: mobility                  -19
#INFO    - 2018-08-28 11:27:47-436: pawn shield               0
#INFO    - 2018-08-28 11:27:47-436: like castling             0
#INFO    - 2018-08-28 11:27:47-436: connected rooks           0
#INFO    - 2018-08-28 11:27:47-436: center control            -15
#INFO    - 2018-08-28 11:27:47-436: king troppism             0
#INFO    - 2018-08-28 11:27:47-436: blocked piece             0
#INFO    - 2018-08-28 11:27:47-436: + Open File               0
#INFO    - 2018-08-28 11:27:47-436: + Open File near king     0
#INFO    - 2018-08-28 11:27:47-436: + Double pawn             0
#INFO    - 2018-08-28 11:27:47-436: + Isolated pawn           -30
#INFO    - 2018-08-28 11:27:47-436: + Space                   0
#INFO    - 2018-08-28 11:27:47-436: + Positionnal             41
#INFO    - 2018-08-28 11:27:47-436: + Bad bishop              0
#INFO    - 2018-08-28 11:27:47-436: + Pawn storm              0
#INFO    - 2018-08-28 11:27:47-436: + Pawn (candidate)        -10
#INFO    - 2018-08-28 11:27:47-436: + Pawn (passed)           -14
#INFO    - 2018-08-28 11:27:47-436:    => white               60
#INFO    - 2018-08-28 11:27:47-436:    => black               74
#INFO    - 2018-08-28 11:27:47-436: all other                 -13
#INFO    - 2018-08-28 11:27:47-436: random noise              0
#INFO    - 2018-08-28 11:27:47-436: Static score : -532
And of course there is a lot of delaying checks in the search tree ...

This kind of blunder is only due to horizon effect or there are things that can be done in the evaluation (better passed pawn scoring ?) to handle this ?
User avatar
Eelco de Groot
Posts: 4563
Joined: Sun Mar 12, 2006 2:40 am
Full name:   

Re: End game analysis

Post by Eelco de Groot »

If you find the correct Qg5+ at depth 14 but not earlier (I see you find it at depth 1 also) you can either try finding it at earlier depth or try to stuff those 14 plies in less nodes. For instance, do you have checks at the beginning of q-search or alternatively, extend checks often in search? Advancing that f-pawn seems not so obvious, it is the only black pawn that still has an opponent in front of him. What you remarked about Asymptote is probably more helpful: that passed pawn on d6 is very dangerous. As you know, a passed pawn on 6th row can not even be stopped by a Rook in endgame. You could try to see what the static evaluation is of Stockfish, with and without a pawn on d6. It is a lot I think. If you evaluate it higher, Black will probably try delaying it (delaying its promotion) with checks. Finding the winning move then might just be luck... :)
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
User avatar
xr_a_y
Posts: 1871
Joined: Sat Nov 25, 2017 2:28 pm
Location: France

Re: End game analysis

Post by xr_a_y »

For now I only look at catpures in qsearch, and capture that give checks have a bonus during ordering.

I'll have a look at passed pawn evaluation. For now it is a bonus depending on rank

Code: Select all

{ 0, 10, 20, 35, 45, 60, 70, 200 };
and a multiplicator (x1.1) if protected, if connected or if outside

I have to tune this ...
User avatar
Eelco de Groot
Posts: 4563
Joined: Sun Mar 12, 2006 2:40 am
Full name:   

Re: End game analysis

Post by Eelco de Groot »

Hello Vivien, Kaissa only finds that move with 38 million nodes so Weini not far behind that. It is not an easy move and Stockfish could probably do better too.

Code: Select all

8/5kpp/p2Pp3/Qp3p2/7q/5P2/6K1/8 b - -

Engine: Kaissa IV (512 MB)
by T. Romstad, M. Costalba, J. Kiiski, G.

23/48  0:01   -3.46    1...Ke8 2.Qxa6 Qg5+ 3.Kh3 Kd7 
                       4.Qxb5+ Kxd6 5.Qe8 h6 6.Qf8+ Kd7 
                       7.Qf7+ Qe7 8.Qg6 Kc6 9.Qg3 Qg5 
                       10.Qe5 Kd7 11.Kh2 Ke7 12.f4 Qf6 
                       13.Qc7+ Ke8 14.Kh3 Qe7 (3.555.364) 2226 

24/36  0:02   -3.54    1...Ke8 2.Qxa6 Qg5+ 3.Kh3 Kd7 
                       4.Qxb5+ Kxd6 5.Qe8 h6 6.Qf8+ Kd7 
                       7.Qf7+ Qe7 8.Qg6 Kc6 9.Qg3 Qg5 
                       10.Qe5 Kd7 11.Qd4+ Ke8 (5.102.026) 2249 

25/42  0:02   -3.61    1...Ke8 2.Qxa6 Qg5+ 3.Kh3 Kd7 4.Qb6 Qc1 
                       5.Qxb5+ Kxd6 6.Qb4+ Qc5 7.Qb7 Qc3 
                       8.Kg3 Qd4 9.Kg2 Qd2+ 10.Kf1 Qc3 
                       11.Kf2 Qc7 12.Qb2 Qc5+ 13.Kf1 Qe3 
                       14.Kg2 Qg5+ (6.219.218) 2281 

26/34  0:03   -3.76++  1...Ke8 (7.210.485) 2282 

26/40  0:03   -3.87++  1...Ke8 (8.051.452) 2289 

26/46  0:04   -3.73    1...Ke8 2.Qxa6 Qg5+ 3.Kf1 Qc1+ 4.Kg2 Qd2+ 
                       5.Kh3 Kd7 6.Qxb5+ Kxd6 7.Qe8 Qf2 
                       8.Qf8+ Kd5 9.Qxg7 Qxf3+ 10.Kh2 Qe2+ 
                       11.Kh3 Qe4 12.Qd7+ Kc4 13.Qa4+ Kc3 
                       14.Qa1+ Kd2 (10.651.300) 2266 

27/31  0:05   -3.69    1...Ke8 2.Qxa6 Qg5+ 3.Kf1 Qc1+ 4.Kg2 Qd2+ 
                       5.Kh3 Kd7 6.Qxb5+ Kxd6 7.Qe8 Qf2 
                       8.Qf8+ Kd5 9.Qxg7 Qxf3+ 10.Kh2 Qf2+ 
                       11.Kh1 Qe1+ 12.Kg2 Qe2+ 13.Kh3 Qe4 
                       14.Qe7 Qh1+ (11.621.468) 2256 

28/39  0:05   -3.76++  1...Ke8 (12.815.407) 2269 

28/39  0:06   -3.69    1...Ke8 2.Qc7 Qd8 3.Qc6+ Qd7 4.Qxa6 Kf7 
                       5.f4 e5 6.fxe5 Ke6 7.Qa1 h5 8.Kf2 h4 
                       9.Qc3 Qa7+ 10.Ke2 Qb7 11.Kf2 g5 
                       12.Qb3+ Kxe5 13.Qc3+ Ke6 14.Qe3+ Kxd6 (14.598.826) 2263 

29/47  0:09   -3.61--  1...Ke8 2.Qc7 (22.207.114) 2297 

29/48  0:10   -3.54--  1...Ke8 2.Qc7 (24.095.247) 2308 

29/48  0:11   -3.43--  1...Ke8 2.Qc7 (25.808.031) 2308 

29/48  0:11   -3.52++  1...Ke8 (27.035.547) 2316 

29/48  0:12   -3.72++  1...Ke8 (27.880.681) 2319 

29/48  0:13   -3.68    1...Ke8 2.Qc7 Qd8 3.Qc6+ Qd7 4.Qxa6 Kf7 
                       5.f4 e5 6.fxe5 Ke6 7.Qa1 Qc6+ 8.Kh2 g5 
                       9.Qa7 Qd7 10.Qd4 h6 11.Qc3 b4 
                       12.Qxb4 Kxe5 13.Qc5+ Ke6 14.Qc4+ Kxd6 (31.813.560) 2332 

30/34  0:14   -3.76++  1...Ke8 (33.619.520) 2332 

30/36  0:14   -3.83++  1...Ke8 (34.438.816) 2336 

30/36  0:16   -3.94++  1...Qg5+ (38.089.366) 2339 

30/45  0:17   -4.04    1...Qg5+ 2.Kf2 Ke8 3.Qxa6 Qd2+ 4.Kg3 Qe1+ 
                       5.Kh3 Kd7 6.Qxb5+ Kxd6 7.Qb2 Qh1+ 
                       8.Kg3 Qg1+ 9.Kh3 Ke7 10.Qe5 Kf7 
                       11.f4 h6 12.Qc7+ Kg6 13.Qe5 Qh1+ 
                       14.Kg3 Qe4 (42.107.432) 2343 

31/44  0:20   -4.09    1...Qg5+ 2.Kf2 Ke8 3.Qc7 Qd8 4.Qc6+ Qd7 
                       5.Qxa6 e5 6.Qa2 Qxd6 7.Qg8+ Kd7 
                       8.Qxg7+ Qe7 9.Qg8 Kc7 10.Ke2 f4 
                       11.Qh8 Kc6 12.Qa8+ Kb6 13.Qb8+ Kc5 
                       14.Qc8+ Kb4 (49.184.944) 2354 

32/46  0:24   -4.16++  1...Qg5+ (57.272.217) 2365 

32/52  0:25   -4.24++  1...Qg5+ (60.868.146) 2370 

32/52  0:27   -4.35++  1...Qg5+ (65.454.711) 2372 

32/57  0:31   -4.01--  1...Qg5+ 2.Kf2 (73.928.303) 2371 

32/57  0:31   -4.25++  1...Qg5+ (75.248.805) 2373 

32/57  0:35   -4.25    1...Qg5+ 2.Kf1 Qc1+ 3.Kg2 Ke8 4.Qxa6 Qc2+ 
                       5.Kh3 Kd7 6.Qxb5+ Qc6 7.Qb3 g5 8.Kg3 h5 
                       9.Kf2 g4 10.fxg4 hxg4 11.Kg3 Qxd6+ 
                       12.Kh4 Ke7 13.Kg5 Kf7 14.Qb2 g3 (84.046.284) 2377 

33/44  0:36   -4.32++  1...Qg5+ (87.422.697) 2374 

33/44  0:38   -4.32    1...Qg5+ 2.Kf1 Qc1+ 3.Kg2 Ke8 4.Qxa6 Qc2+ 
                       5.Kh3 Kd7 6.Qxb5+ Qc6 7.Qb3 g5 8.Kg3 h5 
                       9.Qb2 Qxd6+ 10.Kg2 g4 11.Qb7+ Ke8 
                       12.fxg4 Qd2+ 13.Kg3 hxg4 14.Kh4 Qd6 (91.525.195) 2374
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan