Neverending flaws

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

Moderator: Ras

Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: That nasty knight

Post by Lyudmil Tsvetkov »

Roger Brown wrote:
Lyudmil Tsvetkov wrote:I will not start another thread as there seems to be no interest, but I might post a couple of more intriguing examples as subthreads here.

Hello Lyudmil,

How do you measure interest?

This thread has over 1600 views.

I might not participate in the discussion - because what I know about chess could fill a small thimble - but I am interested in it.

Regards.
Very kind of you, Roger, but a discussion is meaningful when opinions are exchanged.
I am very much aware that a Paris view and a chess eval thread view are universes apart. :)

Thanks for cheering me up.

Later
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Doubled pawns considerations

Post by Lyudmil Tsvetkov »

gladius wrote:
Lyudmil Tsvetkov wrote:Another game between SF and Komodo.

[pgn][PlyCount "95"]
[MLNrOfMoves "47"]
[MLFlags "000100"]
[Event "SCCT"]
[Date "2014.03.17"]
[Round "119"]
[White "Komodo TCECr x64 1c"]
[Black "Stockfish 120314 x64 1c"]
[Result "1-0"]
[EventDate "2014.??.??"]
[ECO "C84"]
[TimeControl "60+1"]


{Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz 2494 MHz W=16.8 plies; 1.010kN/s; Perfect2014t.ctg B=18.8 plies; 1.147kN/s; Perfect2014t.ctg}
1. e4 {[%eval 0,0] [%emt 0:00:00]} 1... e5 {[%eval 0,0] [%emt 0:00:00]} 2. Nf3
{[%eval 0,0] [%emt 0:00:00]} 2... Nc6 {[%eval 0,0] [%emt 0:00:00]} 3. Bb5
{[%eval 0,0] [%emt 0:00:00]} 3... a6 {[%eval 0,0] [%emt 0:00:00]} 4. Ba4
{[%eval 0,0] [%emt 0:00:00]} 4... Nf6 {[%eval 0,0] [%emt 0:00:00]} 5. O-O
{[%eval 0,0] [%emt 0:00:00]} 5... b5 {[%eval 0,0] [%emt 0:00:00]} 6. Bb3
{[%eval 0,0] [%emt 0:00:00]} 6... Bb7 {[%eval 0,0] [%emt 0:00:00]} 7. d3
{[%eval 0,0] [%emt 0:00:00]} 7... Be7 {[%eval 0,0] [%emt 0:00:00]} 8. Nc3
{[%eval 0,0] [%emt 0:00:00]} 8... O-O
{Both last book move [%eval 0,0] [%emt 0:00:00]} 9. Nd5
{[%eval 37,16] [%emt 0:00:04]} 9... Na5 {(Nd4) [%eval 41,18] [%emt 0:00:04]} 10.
Nxe7+ {[%eval 29,17] [%emt 0:00:07]} 10... Qxe7 {[%eval 45,22] [%emt 0:00:00]}
11. Re1 {(Nh4) [%eval 30,17] [%emt 0:00:02]} 11... d6
{(Nxb3) [%eval 39,19] [%emt 0:00:02]} 12. Nh4 {[%eval 29,18] [%emt 0:00:02]}
12... Bc8 {[%eval 43,19] [%emt 0:00:01]} 13. Qf3 {[%eval 32,18] [%emt 0:00:01]}
13... Nxb3 {[%eval 24,20] [%emt 0:00:02]} 14. axb3
{[%eval 35,18] [%emt 0:00:04]} 14... Nd5 {(h6) [%eval 17,22] [%emt 0:00:00]} 15.
Nf5 {(exd5) [%eval 27,18] [%emt 0:00:02]} 15... Bxf5
{[%eval 12,20] [%emt 0:00:02]} 16. exf5 {(exd5) [%eval 27,19] [%emt 0:00:00]}
16... Nb4 {[%eval 19,20] [%emt 0:00:06]} 17. Re2 {[%eval 19,19] [%emt 0:00:05]}
17... c6 {[%eval 21,22] [%emt 0:00:00]} 18. c3 {[%eval 24,18] [%emt 0:00:07]}
18... Nd5 {[%eval 7,23] [%emt 0:00:00]} 19. Bd2
{(d4) [%eval 23,16] [%emt 0:00:02]} 19... Qf6 {[%eval 24,17] [%emt 0:00:04]} 20.
Qe4 {(g4) [%eval 21,16] [%emt 0:00:00]} 20... Rfe8
{[%eval -5,18] [%emt 0:00:04]} 21. h3 {(g4) [%eval 27,17] [%emt 0:00:00]} 21...
Ne7 {[%eval 28,17] [%emt 0:00:07]} 22. g4 {[%eval 24,18] [%emt 0:00:11]} 22...
h5 {[%eval 44,20] [%emt 0:00:02]} 23. c4 {(b4) [%eval 20,16] [%emt 0:00:03]}
23... Qh4 {(g6) [%eval 27,16] [%emt 0:00:04]} 24. Qg2
{(Qf3) [%eval 41,14] [%emt 0:00:05]} 24... Rad8
{(Qf6) [%eval 66,17] [%emt 0:00:15]} 25. Rxa6 {[%eval 59,14] [%emt 0:00:02]}
25... Rb8 {[%eval 93,17] [%emt 0:00:02]} 26. Re4
{(Bc3) [%eval 76,15] [%emt 0:00:02]} 26... Qf6 {[%eval 120,17] [%emt 0:00:03]}
27. Bc3 {[%eval 35534,15] [%emt 0:00:03]} 27... hxg4
{[%eval 105,19] [%emt 0:00:01]} 28. hxg4 {[%eval 77,16] [%emt 0:00:01]} 28...
Qg5 {(Qh6) [%eval 130,20] [%emt 0:00:09]} 29. Ra1
{(f3) [%eval 35534,15] [%emt 0:00:03]} 29... Qh4
{(c5) [%eval 135,17] [%emt 0:00:06]} 30. Re3
{(f4) [%eval 103,15] [%emt 0:00:02]} 30... Qg5
{(g6) [%eval 35534,18] [%emt 0:00:09]} 31. Rh3
{(f4) [%eval 132,14] [%emt 0:00:02]} 31... Qf4
{(Ra8) [%eval 175,19] [%emt 0:00:02]} 32. Rd1
{(Qe4) [%eval 128,16] [%emt 0:00:03]} 32... f6 {[%eval 328,18] [%emt 0:00:05]}
33. Rf3 {(Bd2) [%eval 127,18] [%emt 0:00:02]} 33... Qh6
{[%eval 218,16] [%emt 0:00:01]} 34. Bd2 {(d4) [%eval 116,17] [%emt 0:00:11]}
34... g5 {[%eval 210,17] [%emt 0:00:01]} 35. Rh3
{(fxg6) [%eval 112,17] [%emt 0:00:02]} 35... Qg7 {[%eval 323,16] [%emt 0:00:02]}
36. Be3 {(Qh2) [%eval 127,17] [%emt 0:00:02]} 36... bxc4
{[%eval 165,17] [%emt 0:00:02]} 37. dxc4 {[%eval 118,18] [%emt 0:00:01]} 37...
Rxb3 {(Red8) [%eval 35534,17] [%emt 0:00:00]} 38. Rxd6
{[%eval 156,13] [%emt 0:00:00]} 38... Rxb2 {[%eval 257,18] [%emt 0:00:02]} 39.
Qe4 {(Qf1) [%eval 35534,15] [%emt 0:00:00]} 39... Rb3
{[%eval 35534,17] [%emt 0:00:02]} 40. Rh5 {(Kg2) [%eval 191,14] [%emt 0:00:02]}
40... Rf8 {(Rb2) [%eval 35534,18] [%emt 0:00:01]} 41. Bc5
{(Kg2) [%eval 224,15] [%emt 0:00:00]} 41... Rb7
{(Rbb8) [%eval 419,18] [%emt 0:00:01]} 42. Qd3
{(Kg2) [%eval 294,16] [%emt 0:00:01]} 42... Rbb8
{(Re8) [%eval 466,21] [%emt 0:00:01]} 43. Rd7
{(Kg2) [%eval 379,17] [%emt 0:00:01]} 43... Rbe8
{(Rf7) [%eval 673,20] [%emt 0:00:01]} 44. Qh3
{(Qd6) [%eval 438,19] [%emt 0:00:01]} 44... Rf7 {[%eval 535,20] [%emt 0:00:01]}
45. Rxe7 {(Ra7) [%eval 491,19] [%emt 0:00:00]} 45... Rfxe7
{[%eval 751,20] [%emt 0:00:01]} 46. Bxe7 {[%eval 540,20] [%emt 0:00:01]} 46...
Rxe7 {[%eval 828,20] [%emt 0:00:00]} 47. Rh6 {[%eval 552,19] [%emt 0:00:00]}
47... Rc7 {(Rb7) [%eval 35534,22] [%emt 0:00:02]} 48. Rg6
{[%eval 610,20] [%emt 0:00:01]} 1-0
[/pgn]

[d]r4rk1/2p1qppp/p2p4/1p1npP2/8/1P1P1Q2/1PP2PPP/R1B1R1K1 b - - 0 16
SF sees just 10cps white advantage, Komodo 30cps white advantage. I think white is much better here, and the problem of SF eval seems to be the assessment of the doubled white pawns.

Look very carefully at the position. There are 2 white pairs of doubled pawns - along the b file, and along the f file. Are they due equal penalties? SF thinks so, and probably that is why it sees only a very small white edge. But, in reality, the doubled pawns along the b and f files are of fully different nature. The b doubled pawns are sufficiently enough felt, while the doubled f pawns are almost not felt as a weakness. Actually, f5 even strongly restricts the enemy forces.

For me, both types of doubled pawns should be separated in eval. You have one eval for the general case, as the b doubled pawns, and another one for the specific case of the f doubled pawns, when one of the doubled pawns is into the enemy camp, and the other one into the own camp.

In light of the above, I would suggest the following specification for doubled pawns: do not assign penalty, or decrease it, in the case when one of the doubled pawns is into the own camp and the other one into the enemy camp, i.e., when one of the pawns is on ranks 2-4, and the other one on ranks 5-7. I think this will solve different problems, including in terms of better understanding of space.

What do you think of this suggestion? How does your engine evaluate the above position?
Interesting idea! I've queued this one up.
Many thanks, Gary!

Would be very happy if someone of the team would try to somehow handle scaling down pawns in the middlegame with imbalances with unequal number of pieces. That is the really interesting idea, and an area where SF quite frequently fails.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Raising piece values with imbalances

Post by Lyudmil Tsvetkov »

Just to mention once more: the penalty for Q in the Q vs 3 pieces imbalance follows pretty much the same logic; when one of the side has 2 pieces more than the opponent, it is able to attack and capture enemy pawns, and as such imbalances will usually feature Q+1 pawn vs 3 minors, or Q+3 pawns vs 2Rs + minor, the penalty for the queen is equivalent to scaling down pawns.

With imbalances with one of the sides having just a piece more, the more pieces still easier attack enemy pawns, and, as the side with the more pieces will usually have less pawns, a bonus for the side with the more pieces is equivalent to effectively scaling down pawns.

With imbalances with equal number of pieces the pressure upon enemy pawns is already not there, and therefore scaling down pawns does not make sense here. One can leave the standard imbalance piece/pawn values for this case.
gladius
Posts: 568
Joined: Tue Dec 12, 2006 10:10 am
Full name: Gary Linscott

Re: Doubled pawns considerations

Post by gladius »

Lyudmil Tsvetkov wrote:
gladius wrote:
Lyudmil Tsvetkov wrote: In light of the above, I would suggest the following specification for doubled pawns: do not assign penalty, or decrease it, in the case when one of the doubled pawns is into the own camp and the other one into the enemy camp, i.e., when one of the pawns is on ranks 2-4, and the other one on ranks 5-7. I think this will solve different problems, including in terms of better understanding of space.

What do you think of this suggestion? How does your engine evaluate the above position?
Interesting idea! I've queued this one up.
Many thanks, Gary!

Would be very happy if someone of the team would try to somehow handle scaling down pawns in the middlegame with imbalances with unequal number of pieces. That is the really interesting idea, and an area where SF quite frequently fails.
The doubled pawn test passed, thanks Lyudmil! I formulated it a bit differently, the penalty for a doubled pawn was reduced the further away it is, using "penalty / distance", so 4 squares away would be 1/4 penalty.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Doubled pawns considerations

Post by Lyudmil Tsvetkov »

gladius wrote:
Lyudmil Tsvetkov wrote:
gladius wrote:
Lyudmil Tsvetkov wrote: In light of the above, I would suggest the following specification for doubled pawns: do not assign penalty, or decrease it, in the case when one of the doubled pawns is into the own camp and the other one into the enemy camp, i.e., when one of the pawns is on ranks 2-4, and the other one on ranks 5-7. I think this will solve different problems, including in terms of better understanding of space.

What do you think of this suggestion? How does your engine evaluate the above position?
Interesting idea! I've queued this one up.
Many thanks, Gary!

Would be very happy if someone of the team would try to somehow handle scaling down pawns in the middlegame with imbalances with unequal number of pieces. That is the really interesting idea, and an area where SF quite frequently fails.
The doubled pawn test passed, thanks Lyudmil! I formulated it a bit differently, the penalty for a doubled pawn was reduced the further away it is, using "penalty / distance", so 4 squares away would be 1/4 penalty.
Thanks Gary!

Wonderful implementation. That is exactly how I envisaged it.
You are lucky you are able to program. :)
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Doubled pawns considerations

Post by mcostalba »

Lyudmil Tsvetkov wrote: You are lucky you are able to program. :)
Instead of this:

Code: Select all

         if (doubled)
            value -= Doubled[f];
Gary wrote this:

Code: Select all

         if (doubled)
            value -= Doubled[f] / rank_distance(s, lsb(doubled));
Once you know that value -= Doubled[f] it means 'subtract from value the penalty Doubled[f]' and that lsb(doubled) returns the square of the second pawn (of the doubled ones), I think you can figure out the code yourself ;-)
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Doubled pawns considerations

Post by Lyudmil Tsvetkov »

mcostalba wrote:
Lyudmil Tsvetkov wrote: You are lucky you are able to program. :)
Instead of this:

Code: Select all

         if (doubled)
            value -= Doubled[f];
Gary wrote this:

Code: Select all

         if (doubled)
            value -= Doubled[f] / rank_distance(s, lsb(doubled));
Once you know that value -= Doubled[f] it means 'subtract from value the penalty Doubled[f]' and that lsb(doubled) returns the square of the second pawn (of the doubled ones), I think you can figure out the code yourself ;-)
Hi Marco.

That is too much code for me. :)
BeyondCritics
Posts: 410
Joined: Sat May 05, 2012 2:48 pm
Full name: Oliver Roese

Re: Castling rights

Post by BeyondCritics »

I have analyzed this position with stockfish and the conclusion is, that black is slightly better here, because it has the initiative.
In any case there is no way that white could be better. E.g. stockfish could have played 19...Nd5 with equal chances, or 22...Ba2 23. Kc1 Nd5 again with equal chances, or 23...Rb8+ 24.Kc1 Nc5 25.cxd5 Qc3 again with equal chances, but it refused all that and headed for a complicated endgame.

stockfish lost this game, because it mishandled the endgame somewhere. Consider thel position after 33. Bc4!
[d]8/q2nkp1p/p3pnp1/8/2B5/5P2/1KQ3PP/3R4 b - - 6 33

It would be possible to grab the pawn 33...Qb8+ 34.Qb3 Qxh2. White will then try 35. Qa3+! Ke7 36.Rc1! with the idea Qxg2+ 37.Rc2 Qg5 38.Bxa6 with dangerous attack, but after 36...Qe5+ 37.Ka2 Qc5 black will never loose that game.
The error must be later in the endgame but i am to too lazy to figure that out also.

Oliver
Uri Blass
Posts: 10889
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Doubled pawns considerations

Post by Uri Blass »

Lyudmil Tsvetkov wrote:
mcostalba wrote:
Lyudmil Tsvetkov wrote: You are lucky you are able to program. :)
Instead of this:

Code: Select all

         if (doubled)
            value -= Doubled[f];
Gary wrote this:

Code: Select all

         if (doubled)
            value -= Doubled[f] / rank_distance(s, lsb(doubled));
Once you know that value -= Doubled[f] it means 'subtract from value the penalty Doubled[f]' and that lsb(doubled) returns the square of the second pawn (of the doubled ones), I think you can figure out the code yourself ;-)
Hi Marco.

That is too much code for me. :)
I do not see a problem to understand this code.

If the distance is 1(for example h2 and h3) the penalty is the same
If the distance is 2(for example f3 and f5) the penalty is half of the normal penalty for doubled pawns.
If the distance is 3(for example g4 and g7) the penalty is 1/3 of the normal penalty.
The maximal distance can be 5(for example e2 and e7) and in this case the penalty is 1/5 of the normal penalty.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Doubled pawns considerations

Post by Lyudmil Tsvetkov »

Uri Blass wrote:
Lyudmil Tsvetkov wrote:
mcostalba wrote:
Lyudmil Tsvetkov wrote: You are lucky you are able to program. :)
Instead of this:

Code: Select all

         if (doubled)
            value -= Doubled[f];
Gary wrote this:

Code: Select all

         if (doubled)
            value -= Doubled[f] / rank_distance(s, lsb(doubled));
Once you know that value -= Doubled[f] it means 'subtract from value the penalty Doubled[f]' and that lsb(doubled) returns the square of the second pawn (of the doubled ones), I think you can figure out the code yourself ;-)
Hi Marco.

That is too much code for me. :)
I do not see a problem to understand this code.

If the distance is 1(for example h2 and h3) the penalty is the same
If the distance is 2(for example f3 and f5) the penalty is half of the normal penalty for doubled pawns.
If the distance is 3(for example g4 and g7) the penalty is 1/3 of the normal penalty.
The maximal distance can be 5(for example e2 and e7) and in this case the penalty is 1/5 of the normal penalty.
I think it is clear that what I meant is that it is difficult for me to translate this piece of knowledge into programming code.
Otherwise, I think the idea as specified and implemented by Gary was for the first time proposed in my Little chess evaluation compendium from 2012.

Again, for those who doubt it: specific knowledge works, general knowledge often fails.