Solving the KID

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

Moderators: hgm, Rebel, chrisw

arjuntemurnikar
Posts: 204
Joined: Tue Oct 15, 2013 10:22 pm
Location: Singapore

Re: Solving the KID

Post by arjuntemurnikar »

Sorry, Correction:
arjuntemurnikar wrote:it just incentivises pushing connected pawns (hidden passers) in order to create passers.
I confused between connected and candidate pawns. :(

Anyway, my main point here was that, chains in the true sense is 3 or more pawns connected diagonally, and SF has no specific mention of chains. And the real question of true chain bonus is whether pawn chains are really better than the sum of their parts. That I think is a myth. :)
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: Solving the KID

Post by michiguel »

arjuntemurnikar wrote:Sorry, Correction:
arjuntemurnikar wrote:it just incentivises pushing connected pawns (hidden passers) in order to create passers.
I confused between connected and candidate pawns. :(

Anyway, my main point here was that, chains in the true sense is 3 or more pawns connected diagonally, and SF has no specific mention of chains. And the real question of true chain bonus is whether pawn chains are really better than the sum of their parts. That I think is a myth. :)
I agree, but Lucas said there is. Then, what is it? Why SF gives higher score for black pawns here according to Lucas?
[d]rnbq1rk1/ppp1b1np/3p2pB/3Pp3/2P1Pp2/P1N2N2/1PBQ1PPP/R4RK1 w - - 0 14

...when it should give a higher score for white pawns?

Miguel
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Solving the KID

Post by zullil »

Lyudmil Tsvetkov wrote:
michiguel wrote:
Lyudmil Tsvetkov wrote:I played a game against SF 5, looking at the
Of course, my question is also to the forum at large: how many engines see the below position as winning for white?

[d]r2q1rk1/pb2bppp/1pn2n2/2p1pP2/2PpP3/3P4/PP2B1PP/RNBQNRK1 b - - 0 12
I do not think white is "winning" so easily. Black can play Ne8, and when white plays g4, it could be answered with g5. Meanwhile, white may need to play Nf3 to stop Bg5.

Miguel
Precisely, white will play Nf3, and only after that g4.

Does Gaviota also think black is better here?

It might be interesting to know how other engines perform here and if there is an engine at all that would give the edge to white, as both psqt and space strongly favour black.
After a long search, the very latest Stockfish suggests Ne8, with about a half-pawn advantage to Black:

Code: Select all

info depth 41 seldepth 55 score cp 56 nodes 54918054933 nps 16255260 time 3378479 multipv 1 pv f6e8 e1f3 e8d6 b2b3 f8e8 b1a3 a7a6 a3c2 e7f6 c1b2 b6b5 f3d2 d8c7 e2h5 e8f8 d1e1 c7e7 h5g4 f8b8 e1d1 b8d8
Note that White playing g4 is not in the principal variation.
carldaman
Posts: 2283
Joined: Sat Jun 02, 2012 2:13 am

Re: Solving the KID

Post by carldaman »

arjuntemurnikar wrote:
carldaman wrote:
Arjun, would it be possible to integrate the pointy pawn chain (or as I like to call it 'the pawn chain complex diagonal barrier') into king safety? That way, you could determine where the kings are situated with respect to the pointy pawn chain - either on the safe or unsafe side, and apply the penalties accordingly?

CL
Yes, I will be trying that soon when I get the time to conjure up a patch. :)

Thanks, Arjun, looking forward to your patch! :)


One more thing that I could add is that whatever penalty is given to the King's being on the unsafe/wrong side of the pointy chain, it must be tempered if the piece power remaining on board is too low, so as to render an actual attack unlikely to succeed (since there would only be very few pieces to attack with).

I touched on this in another post:

http://www.talkchess.com/forum/viewtopi ... 17&t=52540

I'm thinking that if that the attacking side's fire power drops below 15-20 piece points (where Q=9, R=5, MP=3) the penalty must be significantly scaled down.

(Perhaps something like this is already accounted for in SF's king safety, but I don't know.)

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

Re: Solving the KID

Post by Lyudmil Tsvetkov »

michiguel wrote:
lucasart wrote:
arjuntemurnikar wrote: Secondly, SF has no eval term for chain pawns
It does. Have a look in pawns.cpp: the chain bonus is an increasing function of the rank. This is an important feature, because it incentivises pushing pawn chains in general (pressure term, gaining space and/or creating king attakcs, and/or creating passed/candidate pawn threats etc.)

Code: Select all

void init() {

  const int bonusesByFile[8] = { 1, 3, 3, 4, 4, 3, 3, 1 };
  int bonus;

  for &#40;Rank r = RANK_1; r < RANK_8; ++r&#41;
      for &#40;File f = FILE_A; f <= FILE_H; ++f&#41;
      &#123;
          bonus = r * &#40;r-1&#41; * &#40;r-2&#41; + bonusesByFile&#91;f&#93; * &#40;r/2 + 1&#41;;
          Connected&#91;f&#93;&#91;r&#93; = make_score&#40;bonus, bonus&#41;;
      &#125;
&#125;
The point I tried to expplain to Lyudmil, is that he keeps looking in the WRONG direction, by trying to "fix" the PAWN evaluation. As always, he never listens to anything, and continues to teach us his misconceptions about Stockfish, so it was a waste of time...

Anyway, I'll explain it again, for you, because I know you will understand. In this position:
[d]rnbq1rk1/ppp1b1np/3p2pB/3Pp3/2P1Pp2/P1N2N2/1PBQ1PPP/R4RK1 w - - 0 14
SF eval is +1.50 for white, and it has nothing to do with mis evaluating pawn structures. Quite the contrary! SF evaluates the pawns as better for black!
From the point of view of pawns, and pawns only, white is better.
Maybe SF give black and advantage based on the chain. But that chain concept is very dubious. If it works, it may be indirectly covering some other issues.

Miguel


In SF chain pawns might be covering deficient space advantage, but only partly. You are wrong, Miguel, and very much so. Chain pawns are extremely useful as a whole, almost as useful as passers, on many occasions I would say even more. They allow you to predict things otherwise it would not be possible to predict.

Concerning the diagram, of course black is much better there in terms of pawns. If you do not understand that f4 and e5 are much stronger than d5, and also the longer chain benefits black as a whole as it serves as a diagonal barrier, as Carl says, then I do not know what to say more.

Btw., your comments here seem funny. If white is better in terms of psqt, mobility, almost everything computable, and yet black has a better position, the reasonable very simple question to you would be: where does the black advantage then stem from, what are the eval factors that contribute to it? Of course pawns! :D, simply nothing other left, and of the available pawn features, the KID chain and its advanced members are the most salient feature.

Arjun has the right to make such comments, because he is inexperienced, but not you.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Solving the KID

Post by Lyudmil Tsvetkov »

arjuntemurnikar wrote:Sorry, Correction:
arjuntemurnikar wrote:it just incentivises pushing connected pawns (hidden passers) in order to create passers.
I confused between connected and candidate pawns. :(

Anyway, my main point here was that, chains in the true sense is 3 or more pawns connected diagonally, and SF has no specific mention of chains. And the real question of true chain bonus is whether pawn chains are really better than the sum of their parts. That I think is a myth. :)
SF gained quite in terms of chain pawns, if not so much in strength, then at least in style of play, I can vouch for that. Look at SF that played at stage 2 or 3 of season 5 in TCEC and SF from beginning of November 2013. 2 totally different versions in terms of style of play, latter SF being much more positional. When you understand pawns, you play better positionally.

There is no sense to argue, you told SF has no chain pawns, and it has. Better learn the code a bit more. Regarding if longer chains are a real phenomenon, providing additional strength, well, a couple of confirmations:

- longer chains usually are also more advanced, so they add strength if you incentivise advanced ranks
- 2 short chains with 1 member each + 1 base pawn, 4 total pawns as a whole equal 1 longer chain of 2 members + 1 base pawn, 3 pawns total as a whole, in terms of bonus. So longer chains get more bonus even with current SF definition of scoring only defended pawns
- the real benefit will come when someone applies successfully the phalanx concept in SF or some other engine, a concept Ralph Stoesser started and which would give bonus to any friendly pawn simultaneously adjacent to 2 other friendly pawns on adjacent files. That is the challenge to do for the future so that engines understand better the benefit of longer chains and bigger groups of pawns over smaller ones. It will not be easy, but is perfectly feasible with some effort and will be a clear gain in terms of positional understanding.

The one thing you should have done, Arjun, instead of repeating time and again how stupid I am and resistent to advice is to have explained to me in plain language, as I kindly asked you, how SF pawn shelter king safety works, so that I could give you some feedback on that. You could have been helpful by doing that, but you preferred to entrench in your self-rightiousness.

The point I asked you that is not any other reason, but simply that SF has a lot to gain in terms of strength by implementing a better king safety, in the first place a much better definition of what a pawn shelter is and how and when it is penalised and incentivised. It is very obvious SF quite frequently misplays positions related to king safety because of its deficient definitions and implementation/scoring of the king pawn shelter. There is really very much to gain from that, but for some reason, SF are very conservative on changing that parameter.

The other thing you must be totally sure: if SF has gained some nice strength from implementing chain pawns up until now, it has twice as much to gain from chain pawns if it improves on them. And there is a large room for improvement: chain pawns simply are a fruitful concept. Some hints:

1. change somewhat the current file scoring, it is very good, but not optimal, from 1,3,3,4 to 1,2.5,3.2,4 or something similar. You can experiment with that, I guarantee there is much to gain from more precise file scoring.
2. score chain pawns on the queen side 10% lower and chain pawns on the king side 10% higher in general. This is a very important rule and as true as you would like it to be. I have seen sooo many games when SF overestimates chain pawns on the queen side, while underestimating chain pawns on the king side. Kingside chain pawns are simply more useful in the middlegame.
3. Implement an additional bonus specifically for KID-related chain pawns, i.e. score some 20-30% higher than current values only KID-related pawns e4,f5,g6,e5 and f6

So much to do, and so much strength and elegance of style to gain. Unfortunately, it is falling on deaf ears...
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Solving the KID

Post by Lyudmil Tsvetkov »

arjuntemurnikar wrote:
Lyudmil Tsvetkov wrote:
Hi Arjun.

Of course, SF has a chain pawn bonus that more or less follows the logic of the candidate passer array to score chains across files and ranks. There were couple of successful tests starting from the middle of October till end of October 2013. At the end Marco applied it.
It seems you know SF history worse than me, althought you are a programmer and able to read the code. But I still think you are kidding.

At the turn of this year the chain pawns were renamed to connected pawns.

You can have a look at the below 2 tests:
http://tests.stockfishchess.org/tests/v ... 5f6d3486d3
http://tests.stockfishchess.org/tests/v ... 51f87d22b3

And I think this is the array SF follows for scoring chain pawns across ranks, while from a to d it is 1,3,3,4 with a getting 1 and central d 4.

Code: Select all

&#123; S&#40;0, 0&#41;, S&#40;17, 0&#41;, S&#40;19, 6&#41;, S&#40;22, 11&#41;, S&#40;33, 33&#41;, S&#40;59, 118&#41;, S&#40;127, 254&#41; &#125;, 
 
60   60   &#61519;      &#123; S&#40;0, 0&#41;, S&#40;17, 0&#41;, S&#40;19, 6&#41;, S&#40;22, 11&#41;, S&#40;33, 33&#41;, S&#40;59, 118&#41;, S&#40;127, 254&#41; &#125;, 
 
61   61   &#61519;      &#123; S&#40;0, 0&#41;, S&#40;16, 0&#41;, S&#40;18, 5&#41;, S&#40;20, 10&#41;, S&#40;30, 30&#41;, S&#40;54, 108&#41;, S&#40;120, 240&#41; &#125;, 
 
62     &#61519; -    &#123; S&#40;0, 0&#41;, S&#40;16, 0&#41;, S&#40;18, 5&#41;, S&#40;20, 10&#41;, S&#40;30, 30&#41;, S&#40;54, 142&#41;, S&#40;120, 240&#41; &#125;, 
 
  62   &#61519; +    &#123; S&#40;0, 0&#41;, S&#40;16, 0&#41;, S&#40;18, 5&#41;, S&#40;20, 10&#41;, S&#40;30, 30&#41;, S&#40;54, 108&#41;, S&#40;120, 240&#41; &#125;, 
 
63   63   &#61519;      &#123; S&#40;0, 0&#41;, S&#40;14, 0&#41;, S&#40;16, 4&#41;, S&#40;18,  9&#41;, S&#40;28, 28&#41;, S&#40;52, 104&#41;, S&#40;118, 236&#41; &#125;
 
64   64   &#61519;    &#125;;
 
That was I was talking about: that the current bonus for the d5 chain pawn is bigger than the bonus for the f4 pawn as being more central and this confuses eval. Also with e5. That is why my suggestion to score chain pawns on the king side higher, right into the array above, or creating a new array. Or simply scoring higher e4,f5,g6,e5 and f6 chain pawns part of KID chains pointing toward the enemy king side.

Excellent idea about the direction of the chain, but how you implement it? I think my suggestion is not bad at all.

One thing I did not understand at Marco's closed code (I am able to understand some code, but other fully not, and I usually do not understand Marco code) is how exactly is closed detector defined, how many closed files you need for this, etc. So I can not comment on your closed storm code. If you could explain, I would be happy as a bit more knowledgeable on the issue, but I hoe you will not say such a detector was never tried...
That is not a chain.

A chain is 3 or more pawns diagonally connected together.

SF has no eval for chains. If you see the history, chain pawns were tried a couple of times (giving penalty to base of the chain, etc etc), and it never worked.

You just look at code comments and parameters and names of parameters, and you think you understand everything about SF eval. You have nothing more than a superficial understanding of things. If you can't read code, you should not talk about code. Sooner or later, you will spurt out nonsense like this. Did I not tell you this before? Oh what the hell... You will just ignore when people try to knock sense into you!
Do not be so self-righteous, Arjun, below your words, where you specifically say SF has no chain pawns:
arjuntemurnikar wrote: Secondly, SF has no eval term for chain pawns (If you see the fishtest history, it was tried several times, but it failed -- seems superfluous, one of those human myths that don't work for engines).
So either you altogether did not know SF has chain pawns, or, which is more likely for me, as I do not believe you so stupid, you pretended not to know.

Regarding the definition of what a chain is, I have to disillusion you that both Wikipedia and Computer chess wiki have it the other way, 2 pawns along the same diagonal, one base and one defended, already being a chain. For example, Wikipedia refers to e4-d5 or d4-e5 pawns as chain formations. If you would like to introduce a new definition, that is another thing.

Btw., when browsing the net for definition of chain, I was surprised of how very little and insignificant information there is about chains, almost non-existing, although chains are very important. Obviously, theory is lagging behind, and inability of engines to play the KID is only one of the consequences.

I think you are a young, ambitious, good-natured man, Arjun, but sometimes it is better to learn and think a bit more instead of simply shutting other people up.
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: Solving the KID

Post by michiguel »

Lyudmil Tsvetkov wrote:
michiguel wrote:
lucasart wrote:
arjuntemurnikar wrote: Secondly, SF has no eval term for chain pawns
It does. Have a look in pawns.cpp: the chain bonus is an increasing function of the rank. This is an important feature, because it incentivises pushing pawn chains in general (pressure term, gaining space and/or creating king attakcs, and/or creating passed/candidate pawn threats etc.)

Code: Select all

void init&#40;) &#123;

  const int bonusesByFile&#91;8&#93; = &#123; 1, 3, 3, 4, 4, 3, 3, 1 &#125;;
  int bonus;

  for &#40;Rank r = RANK_1; r < RANK_8; ++r&#41;
      for &#40;File f = FILE_A; f <= FILE_H; ++f&#41;
      &#123;
          bonus = r * &#40;r-1&#41; * &#40;r-2&#41; + bonusesByFile&#91;f&#93; * &#40;r/2 + 1&#41;;
          Connected&#91;f&#93;&#91;r&#93; = make_score&#40;bonus, bonus&#41;;
      &#125;
&#125;
The point I tried to expplain to Lyudmil, is that he keeps looking in the WRONG direction, by trying to "fix" the PAWN evaluation. As always, he never listens to anything, and continues to teach us his misconceptions about Stockfish, so it was a waste of time...

Anyway, I'll explain it again, for you, because I know you will understand. In this position:
[d]rnbq1rk1/ppp1b1np/3p2pB/3Pp3/2P1Pp2/P1N2N2/1PBQ1PPP/R4RK1 w - - 0 14
SF eval is +1.50 for white, and it has nothing to do with mis evaluating pawn structures. Quite the contrary! SF evaluates the pawns as better for black!
From the point of view of pawns, and pawns only, white is better.
Maybe SF give black and advantage based on the chain. But that chain concept is very dubious. If it works, it may be indirectly covering some other issues.

Miguel


In SF chain pawns might be covering deficient space advantage, but only partly. You are wrong, Miguel, and very much so. Chain pawns are extremely useful as a whole, almost as useful as passers, on many occasions I would say even more. They allow you to predict things otherwise it would not be possible to predict.

Concerning the diagram, of course black is much better there in terms of pawns. If you do not understand that f4 and e5 are much stronger than d5, and also the longer chain benefits black as a whole as it serves as a diagonal barrier, as Carl says, then I do not know what to say more.

Btw., your comments here seem funny. If white is better in terms of psqt, mobility, almost everything computable, and yet black has a better position, the reasonable very simple question to you would be: where does the black advantage then stem from, what are the eval factors that contribute to it? Of course pawns! :D, simply nothing other left, and of the available pawn features, the KID chain and its advanced members are the most salient feature.

Arjun has the right to make such comments, because he is inexperienced, but not you.
Remove all the pieces, white has a better structure. More space in the center, and the break in the Q side is a potential attack from c5 --> to d6, which is closer to the center (and more important) than g4 --> f3. That is better for white. When black plays f5, it is contesting the white center with the idea to knock it down (e4). Then, f4 is a blunder from the point of view of pawn structure _alone_. It releases all the tension. *BUT*, it pays off to "extend" the attack from f5-e4 to g4-f3 if the white king is in the king side. In other words, what makes the f4 dangerous for white is the position of the pieces, not the pawn structure per se.

You are going to find plenty of positions like this (when white played O-O-O) in which white won. That is actually telling you that the issue is the king, not the pawns. The other thing against white is that it is that, quite likely, white will have to trade the powerful B of dark squares, which is critical in the KID.

Miguel
User avatar
Dan Honeycutt
Posts: 5258
Joined: Mon Feb 27, 2006 4:31 pm
Location: Atlanta, Georgia

Re: Solving the KID

Post by Dan Honeycutt »

michiguel wrote:Remove all the pieces, white has a better structure.
Is SF hitting white with a penalty for the hole at b3?

Best
Dan H.
arjuntemurnikar
Posts: 204
Joined: Tue Oct 15, 2013 10:22 pm
Location: Singapore

Re: Solving the KID

Post by arjuntemurnikar »

Lyudmil Tsvetkov wrote: Arjun has the right to make such comments, because he is inexperienced, but not you.
I have better things to do in life than to sit and reason with you, which is pointless, so I am leaving this discussion.