Trading Pieces When Ahead In Material

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Daniel Anulliero
Posts: 761
Joined: Fri Jan 04, 2013 4:55 pm
Location: Nice

Trading Pieces When Ahead In Material

Post by Daniel Anulliero »

Hi all
Here is a game Isa vs Monolith of the Graham tournament : "Legend Of The Monster"

[pgn]
[Site "GrahamCCRL.dyndns.org\Legend Of The Monster.e1e"]
[Date "10-01-2017"]
[White "Isa 2.0.48 64-bit "]
[Black "Monolith 0.3 "]
[Result "1/2-1/2"]
[TimeControl "4025:000 "]

1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. b4 Bxb4 5. c3 Bd6 6. d4 Nf6 7. O-O
O-O 8. Nbd2 Re8 9. Qb3 Qe7 10. Bd3 b6 11. Re1 Bb7 12. Nc4 exd4 13. e5
Na5 14. Nxa5 Bxf3 15. gxf3 bxa5 16. Bg5 Bxe5 17. cxd4 Bxh2 18. Kxh2
Ng4 19. fxg4 Qxg5 20. Bf5 g6 21. Bxd7 Red8 22. Bc6 Rab8 23. Qg3 Rxd4
24. Bf3 Rd2 25. Kg1 Rbb2 26. Re5 Qd8 27. Rae1 Qd4 28. Rf1 a4 29. g5
Qd7 30. a3 Rd3 31. Rfe1 Rb8 32. Qf4 Rd4 33. Qh2 Rd2 34. Re7 Rb1 35. Qe5
Rxe1 36. Qxe1 Qd6 37. Rxc7 Qxc7 38. Qxd2 Qc5 39. Qd8 Kg7 40. Bd5 Qd4
41. Qd7 Qf4 42. Qe7 a5 43. Kf1 Qf5 44. Bc6 Qh3 45. Ke2 Qc3 46. Be4
Qd4 47. Kf3 Qd1 48. Kf4 Qd2 49. Kg3 Qc1 50. Kg2 Qf4 51. Bf3 Qf5 52. Qd8
Qc5 53. Bd1 Qxa3 54. Qxa5 Qd6 55. Bxa4 Qd4 56. f3 Qb2 57. Kg1 Qd4
58. Kf1 h5 59. gxh6 Kxh6 60. Qb5 f5 61. Bb3 Qd2 62. Bc4 Qd1 63. Kg2
Qd2 64. Be2 Qd4 65. Qe8 f4 66. Qc8 Qb2 67. Qf8 Kg5 68. Qe7 Qf6 69. Qc7
Qb2 70. Qc5 Kf6 71. Qd6 Kg5 72. Qe6 Qf6 73. Qc8 Qd4 74. Qg4 Kh6 75. Qh4
Kg7 76. Qe7 Kh6 77. Qc7 Kg5 78. Qc2 Qe5 79. Qd2 Kh4 80. Bc4 Qg5 81. Kf1
Qf5 82. Qe1 Kg5 83. Qe7 Kh6 84. Qh4 Kg7 85. Qf2 Qd7 86. Kg2 Qe7 87. Qd4
Qf6 88. Qe4 Kh7 89. Kg1 Kh6 90. Kf2 Kg5 91. Bd3 Kh6 92. Qd5 Qh4 93. Ke2
Qh2 94. Kd1 Qg1 95. Kd2 Qf2 96. Kc3 Qb6 97. Be4 Qe3 98. Kb4 Qb6 99. Kc4
Qa6 100. Kc3 Qa1 101. Kb3 Qf6 102. Qc5 Qf7 103. Kc3 Qf6 104. Kc2 Qe6
105. Bd3 Qa2 106. Kd1 Qa4 107. Kd2 Qd7 108. Qe5 Qf7 109. Ke1 Kh7 110. Kf1
Kg8 111. Be4 Kh7 112. Qd4 Qc7 113. Kg2 Qc1 114. Qd7 Kh6 115. Bxg6
Kxg6 116. Qe6 Kg5 117. Qe5 Kg6 118. Kh3 Qf1 119. Kg4 Qg1 120. Kxf4
1/2-1/2
[/pgn]

in this position , if Isa trade the queen , it win .

[d]8/4Q3/5qp1/6k1/5p2/5P2/4B1K1/8 w - - 6 69

But it never traded the queens and the game went to the 50 moves rules :

Code: Select all

1 347 0        51   e7h7

2 274 0       271   e7c5 f6f5 c5d4
3 347 0       821   e7h7 f6b2 g2f2

4 268 0      2482   e7d7 f6f5 d7d8 f5f6 d8c7
5 274 0      2427   e7d7 f6f5 d7d8 f5f6 d8d5 f6f5 d5d4
6 299 0      9801   e7d7 g5h6 e2d3 f6g5 g2f1 g5g3 f1e2
7 295 0     18504   e7d7 g5h6 e2d3 f6b2 g2h3 b2f6 d7g4 h6h7

8 273 0     51285   e7d7 f6f5 d7d8 f5f6 d8c7 g5h6 e2d3 f6b2 g2h3 b2d4

9 270 0     92322   e7d7 f6f5 d7d8 f5f6 d8c7 f6f5 c7g7 f5f6 g7h7 g5f5
10 268 0    400921   e7d7 f6f5 d7d8 f5f6 d8c7 f6b2 c7c5 g5h6 g2f2 b2d2 c5e5 h6h7
11 268 1    721217   e7d7 f6f5 d7d8 f5f6 d8c7 f6f5 c7h7 g5f6 h7h8 f6e7 h8g7 f5f7 g7e5 f7e6 e5c7 e7e8

12 269 3   1260757   e7d7 f6f5 d7d8 f5f6 d8c7 f6f5 c7h7 f5c2 h7e7 g5h6 e7f8 h6h5 f8h8 h5g5 h8d8 g5h6 d8e7
13 268 12   4829314   e7d7 f6f5 d7d8 f5f6 d8c7 f6f5 c7h7 f5c2 h7e7 g5h6 e7e6 c2f5 e6f5 g6f5

14 269 25   7351506   e7d7 f6f5 d7d8 f5f6 d8c7 f6f5 c7h7 f5c2 h7e7 g5h6 g2f1 c2f5 f1f2 f5g5 e7f8 h6h5 e2c4


I found an Idea to avoid this kind of things :
"When our engine is ahead in material , increase the ennemy pieces values "
I tried to increase the values by 20%

Code: Select all

1 175 0        41   e7f6 g5f6
2 202 0        64   e7f6 g5f6 e2c4
3 188 0       193   e7f6 g5f6 e2d3 f6g5

4 202 0       274   e7f6 g5f6 e2d3 f6g5 d3c4
5 196 0       665   e7f6 g5f6 e2d3 g6g5 g2f2 f6e5

6 196 0      1558   e7f6 g5f6 e2d3 g6g5 g2f2 f6e5 f2e2
7 199 0      4360   e7f6 g5f6 e2d3 f6g5 g2f2 g5f6 f2e2 f6g5
8 206 0      6618   e7f6 g5f6 e2d3 g6g5 g2f2 f6e5 f2e2 e5d4 d3f5

9 207 0     11747   e7f6 g5f6 e2d3 g6g5 g2f2 f6e5 f2e2 e5d4 d3f5 d4e5
10 206 0     26803   e7f6 g5f6 e2d3 f6g5 g2f2 g5f6 f2e2 g6g5 d3c4 f6e5 e2d2
11 207 0     36894   e7f6 g5f6 e2d3 f6g5 g2f2 g5f6 f2e2 g6g5 e2d2 f6e5 d3c4

12 214 0     65232   e7f6 g5f6 e2d3 f6g5 g2f2 g5f6 f2e2 g6g5 d3e4 f6e6 e2d3 e6e5 d3c4
13 225 0    119568   e7f6 g5f6 e2d3 f6g5 g2f2 g5f6 d3e4 g6g5 f2g2 f6e5 g2h3 e5e6 h3g4 e6f6
14 226 0    214227   e7f6 g5f6 e2d3 f6g5 g2f2 g5f6 d3e4 g6g5 f2g2 f6e5 g2h3 e5e6 h3g4 e6f6 e4d3
15 232 1    380048   e7f6 g5f6 e2d3 f6g5 g2f2 g5f6 d3e4 f6g5 f2e2 g5f6 e2d3 f6f7 e4d5 f7e7 d3e4 e7d6 d5c4

16 235 1    580772   e7f6 g5f6 e2d3 f6g5 g2f2 g5f6 d3e4 f6g5 f2e2 g5f6 e2d3 g6g5 d3d4 f6e6 e4g6 e6d6 g6d3
17 258 3   1455000   e7f6 g5f6 g2f2 f6g5 e2d1 g5h5 f2e2 h5h4 e2d3 h4h3 d3e4 h3g3 d1b3 g6g5 b3e6 g3f2 e6c4 f2g3
18 258 6   2264667   e7f6 g5f6 g2f2 f6g5 e2d1 g5h5 f2e2 g6g5 e2d3 h5g6 d3e4 g6f6 d1c2 f6g6 e4d5
19 325 12   4593952   e7f6 g5f6 g2h3 f6g5 e2b5 g5h5 b5d7 h5g5 d7g4 g5h6 h3h4 g6g5 h4h3 h6g6 g4c8 g6h5 c8f5 g5g4 f3g4

Now It trade the queens , and the depth increase too
But I wonder if it is as simple like that
There must be some problems with :
-Enemy passers ?
-Mate threats ?

Advices are welcome
Dany
Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 3:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Trading Pieces When Ahead In Material

Post by Michael Sherwin »

Hi Dany,

Watching that game was frustrating. I was practically screaming, "EXCHANGE QUEENS ISA". But she was ignoring me, lol.

I remembered why Romi exchanges queens almost instantly in that position. Romi has eval history tables. They are created in search just like normal history tables except that they are used in the eval to bonus some moves over other moves. Exchanging queens in that position would have a higher history value. I call this idea feedback from search to the eval. Tord later included a feedback idea in Glaurung but I could not tell how it compared to my idea. Way back the early Stockfish kept the feedback idea. I don't know if current Stockfish still keeps the idea or not. 8-)

Good luck with figuring this out! :D
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
jdart
Posts: 4375
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: Trading Pieces When Ahead In Material

Post by jdart »

You have to be a little careful here. If White's pawn was on the h file, the queenless position would be drawn.

--Jon
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Trading Pieces When Ahead In Material

Post by Evert »

If the value of the bishop goes up more than the value of a pawn with decreasing game-phase, that would also encourage the trade. Note that you also need to overcome any residual from the Queen evaluation, but presumably those are roughly balanced.
User avatar
hgm
Posts: 28123
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Trading Pieces When Ahead In Material

Post by hgm »

The logical way to cause the desired behavior is to have higher piece values in the end-game than in the opening, e.g. all 50% higher. Then, when you have a material advantage, that advantage will also grow whe the game phas advance towards the end-game. So the side that is ahead can increase his advantage by simplifying.

This won't affect the tendency to trade Pawns, as conventionally the number of Pawns doesn't affect game phase.
zenpawn
Posts: 349
Joined: Sat Aug 06, 2016 8:31 pm
Location: United States

Re: Trading Pieces When Ahead In Material

Post by zenpawn »

Michael Sherwin wrote:Romi has eval history tables. They are created in search just like normal history tables except that they are used in the eval to bonus some moves over other moves. Exchanging queens in that position would have a higher history value. I call this idea feedback from search to the eval. Tord later included a feedback idea in Glaurung but I could not tell how it compared to my idea. Way back the early Stockfish kept the feedback idea. I don't know if current Stockfish still keeps the idea or not. 8-)
Could you please elaborate on this concept? Thanks!
Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 3:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Trading Pieces When Ahead In Material

Post by Michael Sherwin »

zenpawn wrote:
Michael Sherwin wrote:Romi has eval history tables. They are created in search just like normal history tables except that they are used in the eval to bonus some moves over other moves. Exchanging queens in that position would have a higher history value. I call this idea feedback from search to the eval. Tord later included a feedback idea in Glaurung but I could not tell how it compared to my idea. Way back the early Stockfish kept the feedback idea. I don't know if current Stockfish still keeps the idea or not. 8-)
Could you please elaborate on this concept? Thanks!
In the search I have this.

Code: Select all

    if(evalHistTbln[fig][ts] > 20000) {
      evalHistTbln[fig][ts] /= 2;
      evalHistTblg[fig][ts] /= 2;
    }

    if(!inNull) {
      evalHistTbln[fig][ts]++;
    }

    if(h->node->score > alpha) {
      if(!inNull) {
        evalHistTblg[fig][ts] += 16;
And in the Eval I have this.

Code: Select all

    g = evalHistTblg[WQ][sq]; n = evalHistTbln[WQ][sq];
    wQueenTbl[sq] += (n > 49 ? g/n : 0);
It is not a large bonus but the idea is if in Daniel's situation above the WQ takes the BQ because that move gets a bonus from the history table more than other moves get.
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
zenpawn
Posts: 349
Joined: Sat Aug 06, 2016 8:31 pm
Location: United States

Re: Trading Pieces When Ahead In Material

Post by zenpawn »

So, for the most part, it's a standard history table (do you have a separate one for move ordering?), but you're using it in eval to give a piece square bonus. Neat idea.
Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 3:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Trading Pieces When Ahead In Material

Post by Michael Sherwin »

zenpawn wrote:So, for the most part, it's a standard history table (do you have a separate one for move ordering?), but you're using it in eval to give a piece square bonus. Neat idea.
There is also a standard history table for the search. It has a shorter period. The eval history table has a longer period for stability.
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
zenpawn
Posts: 349
Joined: Sat Aug 06, 2016 8:31 pm
Location: United States

Re: Trading Pieces When Ahead In Material

Post by zenpawn »

Michael Sherwin wrote:
zenpawn wrote:So, for the most part, it's a standard history table (do you have a separate one for move ordering?), but you're using it in eval to give a piece square bonus. Neat idea.
There is also a standard history table for the search. It has a shorter period. The eval history table has a longer period for stability.
By which you mean the += 16 versus, say, depth ^ 2 ?