Queens vs Knights

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

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Queens vs Knights broadcast

Post by hgm »

Evert wrote:Anyway, moving on to a more interesting question: do you have any idea what the shape of the dependence should be? Right now I have C*(EnemyKnights-2)*OwnQueens, when EnemyKnights > 2, which is of course a bit arbitrary and not obviously correct. Should the scaling be linear, or perhaps of the form C*(EnemyKnights-1)*(EnemyKnights-2)*OwnQueens? Any thoughts?
The general term is A*OwnQueens - B*EnemyKnights - C*OwnQueens*EnemyKnights. Any linear terms (implicitly included by adding constants to the number of pieces) can be hidden in the base values of the pieces. A=11, B=3 and C=2/3 seems to explain the Q-3N (perfect equality) and 3Q-7N cases (+2 for the Knights). It would make 3Q-6N about +3 for the Queens, which also sounds about right.

Of course there should be similar terms for Q-R and Q-B, or you would strongly overestimate Queen in imbalances involving those. To get Q-2R a slight advantage for the Rooks, (as additive Kaufman values would have it) the QR constant would have to be ~3/4. The QB constant is probably somewhat smaller than the QN constant, which could be due to the fact that Knights can attack Queens with impunity, but Bishops can only do it when protected. It would be interesting to see how Chancellor value gets depressed against hordes of minors, and whether these suffer more from Bishops than from Knights (as the bite back against Knights). It would also be interesting to try 4Q vs 8N (predicted to be +1.33 in favor of the Knights, with these constants).

Note that in the middle game the full predicted Scharnagl depression would not really apply, because you can count on many of the minors being traded against each other, thus relaxing the problem before the Queen(s) really start to suffer. Piece values are heavily dominated by their values in the late end-game, even if they are of little practicle use earlier in the game. (Rooks are a good example of that.) So in a middle-game position it might be better to calculate the Scharnagle correction based on the imbalance of pieces in each class, weighting in the actual correction only for a small fraction.

It is a tricky matter. If the current correction is much larger than the projected end-game correction after trading all equal material, this extra advantage can only be maintained by avoiding that trading, which then suppresses the value of that lower material, ('induced, or 2nd-order Scharnagl effect'), eating away part of (or perhaps even more than) the advantage you would have on the stronger piece in the current situation. With 2Q + N vs Q + 4N, the correction would be C*(2*4 - 1*1) = 7*C, with 2Q vs Q+3N it would be 6*C, and with Q vs 3N it would be 3*C. Maintaining the 7*C advantage would thus force a trade-avoiding strategy on both Q (vs. 2Q) and 4N (vs N). And 2Q can easily interdict as many squares as 4N, so the coefficient of a QQ term could be 2.5*C, so that Q-trade avoidance would cost you 5*C in the 2Q-Q situation, leaving only 2*C out of the 7*C that you tried to maintain, i.e. not better then when you just let the Q-Q trade happen.

So basically the correction should be calulated for every combination of trade-avoiding / non-trade-avoding strategies, the term only included for avoided trading pairs. And then you should take the one that comes out best.
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Queens vs Knights broadcast

Post by hgm »

I now restarted the broadcast (with QueeNy vs QueeNy games). It died tonight because of a very strange network problem with the PC it was running on, and for which I had to reset it this morning to cure it: the network seemed to be working, but any request I made would just give me a blank page. Restarting FireFox, or connecting to the WiFi of the neighbors did not solve it. Other computers on the same WLAN had no access problems at all.

Rebooting solved it. Weird.

[Edit] I changed the TC so that the Queens get 20 min per 40 moves, and the Knights only 2 min (starting with game 23). That way the games will last approximately as long as with 10 min each, and the Queens will have a depth advantage of 2-3 ply.

So the engines have the same knowledge now, but the Queen side is tactically superior, and should normally be some 200 Elo stronger. Which again would be good for a 65% score in an equal position.

I also found the problem with deposition of the game result; this required to deposit "result 0-1" as a move, and I had overlooked that spaces are not allowed in URLs, but have to be encoded as "%20". I now fixed that, so we can see if it works. For games that are finished the result (+, - or =) would be displayed in the game overview, instead of the side to move (w or b). Selecting such a game for viewing would not set the clocks running, or cause periodic polling for new PVs (which would obviously not belong to the game), as it does for unfinished games.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Queens vs Knights broadcast

Post by Evert »

I'm not sure I understand your general term. You can calculate the material part of the evaluation (simplifying to Queens and Knights only) as

Code: Select all

eval = Q * OwnQueens + N * OwnKnights + imbalance&#40;OwnQueens, EnemyKnights&#41; - &#40;Own <=> Enemy&#41;.
For the case at hand (Q/N on one side only), that simplifies to

Code: Select all

eval = Q * OwnQueens - N * EnemyKnights + imbalance&#40;OwnQueens, EnemyKnights&#41;
So any terms in imbalance() that are simply proportional to OwnQueens or EnemyKnights can be absorbed in the piece value, so only cross terms and quadratic (or higher order) terms survive. So the lowest order form should be something like

Code: Select all

imbalance&#40;OQ, EN&#41; = C&#91;0&#93;*OQ*OQ + C&#91;1&#93;*EN*EN + C&#91;2&#93;*OQ*EN
I'm not sure what to make of the quadratic terms, but since they don't depend on the other material present, I'm tempted to split those off from the imbalance, so we get

Code: Select all

eval = &#40;Q + C&#91;0&#93;*OQ&#41;*OQ + &#40;N + C&#91;1&#93;*EN&#41;*EN + imbalance'&#40;OQ, EN&#41;
This gets you something like the "redundancy" terms that Larry Kaufman talked about in his paper on imbalances. Ok, I guess those are the A and B term in your expression. Anyway, this leaves

Code: Select all

imbalance'&#40;OQ, EN&#41; = C&#91;2&#93;*OQ*EN
for the imbalance proper.

Now, the interesting thing about all of this is that Stockfish actually uses a general quadratic form to evaluate material (which I think it inherited from Glaurung), but it clearly doesn't handle this extreme case correctly. I wonder if it can be tuned so that it does, without affecting the normal case (no more than two knights and one queen per side).

Of course, this assumes that higher order than quadratic terms are negligible.

For a mix of pieces, like in the opening position of regular chess, the minors are balanced on both sides, so they are fated to be traded against each other, leaving the Queens (and Rooks) mostly unaffected, as you say.

I have the feeling that I need to sit down and work all of this out into some sort of algorithm, but it's daunting. I would very much like to have something like this for SjaakII though.
User avatar
Guenther
Posts: 4606
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: Queens vs Knights broadcast

Post by Guenther »

hgm wrote:
Evert wrote:Anyway, moving on to a more interesting question: do you have any idea what the shape of the dependence should be? Right now I have C*(EnemyKnights-2)*OwnQueens, when EnemyKnights > 2, which is of course a bit arbitrary and not obviously correct. Should the scaling be linear, or perhaps of the form C*(EnemyKnights-1)*(EnemyKnights-2)*OwnQueens? Any thoughts?
The general term is A*OwnQueens - B*EnemyKnights - C*OwnQueens*EnemyKnights. Any linear terms (implicitly included by adding constants to the number of pieces) can be hidden in the base values of the pieces. A=11, B=3 and C=2/3 seems to explain the Q-3N (perfect equality) and 3Q-7N cases (+2 for the Knights). It would make 3Q-6N about +3 for the Queens, which also sounds about right.

Of course there should be similar terms for Q-R and Q-B, or you would strongly overestimate Queen in imbalances involving those. To get Q-2R a slight advantage for the Rooks, (as additive Kaufman values would have it) the QR constant would have to be ~3/4. The QB constant is probably somewhat smaller than the QN constant, which could be due to the fact that Knights can attack Queens with impunity, but Bishops can only do it when protected. It would be interesting to see how Chancellor value gets depressed against hordes of minors, and whether these suffer more from Bishops than from Knights (as the bite back against Knights). It would also be interesting to try 4Q vs 8N (predicted to be +1.33 in favor of the Knights, with these constants).

Note that in the middle game the full predicted Scharnagl depression would not really apply, because you can count on many of the minors being traded against each other, thus relaxing the problem before the Queen(s) really start to suffer. Piece values are heavily dominated by their values in the late end-game, even if they are of little practicle use earlier in the game. (Rooks are a good example of that.) So in a middle-game position it might be better to calculate the Scharnagle correction based on the imbalance of pieces in each class, weighting in the actual correction only for a small fraction.

It is a tricky matter. If the current correction is much larger than the projected end-game correction after trading all equal material, this extra advantage can only be maintained by avoiding that trading, which then suppresses the value of that lower material, ('induced, or 2nd-order Scharnagl effect'), eating away part of (or perhaps even more than) the advantage you would have on the stronger piece in the current situation. With 2Q + N vs Q + 4N, the correction would be C*(2*4 - 1*1) = 7*C, with 2Q vs Q+3N it would be 6*C, and with Q vs 3N it would be 3*C. Maintaining the 7*C advantage would thus force a trade-avoiding strategy on both Q (vs. 2Q) and 4N (vs N). And 2Q can easily interdict as many squares as 4N, so the coefficient of a QQ term could be 2.5*C, so that Q-trade avoidance would cost you 5*C in the 2Q-Q situation, leaving only 2*C out of the 7*C that you tried to maintain, i.e. not better then when you just let the Q-Q trade happen.

So basically the correction should be calulated for every combination of trade-avoiding / non-trade-avoding strategies, the term only included for avoided trading pairs. And then you should take the one that comes out best.
I think the number of pawns should be considered here too.
With 6-8 Pawns I believe the N side is even stronger.
No idea for other pawn distributions.
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Queens vs Knights broadcast

Post by hgm »

Evert wrote: I would very much like to have something like this for SjaakII though.
Well, the algorithm is basically this:

The 'material strategy' of each player can be represented by a 'interdiction matrix' of Booleans, which for each pair of piece types indicates whether he will try to avoid that his piece of the pair will be traded 1-on-1 for the opponent's piece in the pair. Usually any higer-valued piece would be interdicted by any lower-valued piece, but in the case of a very small base-value difference, or of a type that is causing extreme imbalance effects, 'counter-intuitive trading' might be better.

The possible material strategies of the players then have to be converted to a score adjustment, to find the optimal strategy for each of them. Pieces amongst which no trade avoidance exists will be traded for each other. If not exactly equally valued, this will result in a loss of the difference in base value. They will be removed from the piece counts, to determine the 'persistent imbalance'.

The latter imbalance will then be used to calculate the Scharnagle effect, based on how much it detracts from the value of a piece of type A to avoid trading of it for a piece of type B, and the number of A and B left. This is then added to any trading loss of the previous step.

The result is a score correction that applies when the two strategies encounter each other. This then has to be calculated for every possible strategy, and the scores have to be minimaxed to determine the optimal one. In principle there is a very large number of possible strategies; in Chess there are 4 piece types, so 16 type pairs. (One assumes it never pays to trade pieces for Pawns, or sacrifice a King.) That makes 64K possible strategies for each player, or 4G strategy encounters.

In practice most strategies make no sense, however. The Q-R and R-minor value differences are so large, that not avoiding these trades is suicidal in any realistic case. This leaves only Q-Q, R-R, B-B, N-N, B-N and N-B interdiction open for modification, for 64 different strategies, or 4096 strategy pairs. (In fact strategy pairs where both sides avoid the same trade never makes sense, as what good is for one is bad for the other in a zero-sum game. So only 3^6 = 729 strategy pairs have to be evaluated and minimaxed. The number could be driven up again by distinguishing first-Vishop and second-Bishop as distinguishable types, though.)
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Queens vs Knights broadcast

Post by hgm »

hgm wrote:I now restarted the broadcast (with QueeNy vs QueeNy games).
I was wondering why the broadcast suddenly failed to promote Pawns that reached last rank. It turned out that QueeNy fails to put a promotion suffix on promotion moves. The broadcaster takes the moves from the communication with the first engine (because in human-engine mode, which you would have in operator-mediated computer tournaments, there is no second engine!). And before this was Polyglot/Stockfish, which does print moves compliantly, and receives them compliently from the GUI. So I had not noticed this problem before.

I went to 20 min vs 5 min now, because 2 min obviously was too fast for QueeNy, and made it blunder away Pawns like flies... Still a time odds of a factor 4, which should be good for at least 100 Elo.

[Edit] Game 29 was interesting: it went through a 2Q vs 5N stage, and even Q vs 3N, and the Knights won that.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Queens vs Knights broadcast

Post by Lyudmil Tsvetkov »

Guenther wrote:
hgm wrote:
Evert wrote:Anyway, moving on to a more interesting question: do you have any idea what the shape of the dependence should be? Right now I have C*(EnemyKnights-2)*OwnQueens, when EnemyKnights > 2, which is of course a bit arbitrary and not obviously correct. Should the scaling be linear, or perhaps of the form C*(EnemyKnights-1)*(EnemyKnights-2)*OwnQueens? Any thoughts?
The general term is A*OwnQueens - B*EnemyKnights - C*OwnQueens*EnemyKnights. Any linear terms (implicitly included by adding constants to the number of pieces) can be hidden in the base values of the pieces. A=11, B=3 and C=2/3 seems to explain the Q-3N (perfect equality) and 3Q-7N cases (+2 for the Knights). It would make 3Q-6N about +3 for the Queens, which also sounds about right.

Of course there should be similar terms for Q-R and Q-B, or you would strongly overestimate Queen in imbalances involving those. To get Q-2R a slight advantage for the Rooks, (as additive Kaufman values would have it) the QR constant would have to be ~3/4. The QB constant is probably somewhat smaller than the QN constant, which could be due to the fact that Knights can attack Queens with impunity, but Bishops can only do it when protected. It would be interesting to see how Chancellor value gets depressed against hordes of minors, and whether these suffer more from Bishops than from Knights (as the bite back against Knights). It would also be interesting to try 4Q vs 8N (predicted to be +1.33 in favor of the Knights, with these constants).

Note that in the middle game the full predicted Scharnagl depression would not really apply, because you can count on many of the minors being traded against each other, thus relaxing the problem before the Queen(s) really start to suffer. Piece values are heavily dominated by their values in the late end-game, even if they are of little practicle use earlier in the game. (Rooks are a good example of that.) So in a middle-game position it might be better to calculate the Scharnagle correction based on the imbalance of pieces in each class, weighting in the actual correction only for a small fraction.

It is a tricky matter. If the current correction is much larger than the projected end-game correction after trading all equal material, this extra advantage can only be maintained by avoiding that trading, which then suppresses the value of that lower material, ('induced, or 2nd-order Scharnagl effect'), eating away part of (or perhaps even more than) the advantage you would have on the stronger piece in the current situation. With 2Q + N vs Q + 4N, the correction would be C*(2*4 - 1*1) = 7*C, with 2Q vs Q+3N it would be 6*C, and with Q vs 3N it would be 3*C. Maintaining the 7*C advantage would thus force a trade-avoiding strategy on both Q (vs. 2Q) and 4N (vs N). And 2Q can easily interdict as many squares as 4N, so the coefficient of a QQ term could be 2.5*C, so that Q-trade avoidance would cost you 5*C in the 2Q-Q situation, leaving only 2*C out of the 7*C that you tried to maintain, i.e. not better then when you just let the Q-Q trade happen.

So basically the correction should be calulated for every combination of trade-avoiding / non-trade-avoding strategies, the term only included for avoided trading pairs. And then you should take the one that comes out best.
I think the number of pawns should be considered here too.
With 6-8 Pawns I believe the N side is even stronger.
No idea for other pawn distributions.
so far, we have no data.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Queens vs Knights broadcast

Post by Lyudmil Tsvetkov »

Evert wrote:
Lyudmil Tsvetkov wrote: what are your scores for Nightfish vs regular SF?

playing both sides?
8,5-1,5 in favour of Nightfish. Stockfish' single win was with Black.

Yeah, small number of games, but there's only so much time I have to invest in this.
and the N-Q score?

astounding how much eval changes everyting.

both engines have the very same search...

and some people don't believe in eval.
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Queens vs Knights broadcast

Post by Lyudmil Tsvetkov »

Evert wrote:
hgm wrote: A Stockfish that knows two (extra) Knights are better than a Queen is a stronger player than a Stockfish that doesn't know it. That in itself is evidence that two Knights are better than a Queen her, and that the Knights thus have the advantage.
Anyway, moving on to a more interesting question: do you have any idea what the shape of the dependence should be? Right now I have C*(EnemyKnights-2)*OwnQueens, when EnemyKnights > 2, which is of course a bit arbitrary and not obviously correct. Should the scaling be linear, or perhaps of the form C*(EnemyKnights-1)*(EnemyKnights-2)*OwnQueens? Any thoughts?
that is not very true, although still a good guess.

with 7 knights and 7 queens, you are giving the knight side tremendoius bonus for nothing.

maybe a better formula would be B(bonus)*(own knights - enemy queens)*(own knights)
Lyudmil Tsvetkov
Posts: 6052
Joined: Tue Jun 12, 2012 12:41 pm

Re: Queens vs Knights broadcast

Post by Lyudmil Tsvetkov »

hgm wrote:
Evert wrote:Anyway, moving on to a more interesting question: do you have any idea what the shape of the dependence should be? Right now I have C*(EnemyKnights-2)*OwnQueens, when EnemyKnights > 2, which is of course a bit arbitrary and not obviously correct. Should the scaling be linear, or perhaps of the form C*(EnemyKnights-1)*(EnemyKnights-2)*OwnQueens? Any thoughts?
The general term is A*OwnQueens - B*EnemyKnights - C*OwnQueens*EnemyKnights. Any linear terms (implicitly included by adding constants to the number of pieces) can be hidden in the base values of the pieces. A=11, B=3 and C=2/3 seems to explain the Q-3N (perfect equality) and 3Q-7N cases (+2 for the Knights). It would make 3Q-6N about +3 for the Queens, which also sounds about right.

Of course there should be similar terms for Q-R and Q-B, or you would strongly overestimate Queen in imbalances involving those. To get Q-2R a slight advantage for the Rooks, (as additive Kaufman values would have it) the QR constant would have to be ~3/4. The QB constant is probably somewhat smaller than the QN constant, which could be due to the fact that Knights can attack Queens with impunity, but Bishops can only do it when protected. It would be interesting to see how Chancellor value gets depressed against hordes of minors, and whether these suffer more from Bishops than from Knights (as the bite back against Knights). It would also be interesting to try 4Q vs 8N (predicted to be +1.33 in favor of the Knights, with these constants).

Note that in the middle game the full predicted Scharnagl depression would not really apply, because you can count on many of the minors being traded against each other, thus relaxing the problem before the Queen(s) really start to suffer. Piece values are heavily dominated by their values in the late end-game, even if they are of little practicle use earlier in the game. (Rooks are a good example of that.) So in a middle-game position it might be better to calculate the Scharnagle correction based on the imbalance of pieces in each class, weighting in the actual correction only for a small fraction.

It is a tricky matter. If the current correction is much larger than the projected end-game correction after trading all equal material, this extra advantage can only be maintained by avoiding that trading, which then suppresses the value of that lower material, ('induced, or 2nd-order Scharnagl effect'), eating away part of (or perhaps even more than) the advantage you would have on the stronger piece in the current situation. With 2Q + N vs Q + 4N, the correction would be C*(2*4 - 1*1) = 7*C, with 2Q vs Q+3N it would be 6*C, and with Q vs 3N it would be 3*C. Maintaining the 7*C advantage would thus force a trade-avoiding strategy on both Q (vs. 2Q) and 4N (vs N). And 2Q can easily interdict as many squares as 4N, so the coefficient of a QQ term could be 2.5*C, so that Q-trade avoidance would cost you 5*C in the 2Q-Q situation, leaving only 2*C out of the 7*C that you tried to maintain, i.e. not better then when you just let the Q-Q trade happen.

So basically the correction should be calulated for every combination of trade-avoiding / non-trade-avoding strategies, the term only included for avoided trading pairs. And then you should take the one that comes out best.
I reached the magic formula '133cps advantage for 8Ns over 4Qs' and read no further.

your basic conception is true, but your numbers are awful.

that is what we are actually arguing for.

the effect is present, but the numbers are quite different.

it is more or less certain 3Ns have some 60-70cps advantage over a single queen in the general case(with more pieces for both sides added).
the more pieces added, the bigger the knight advantage.
with none piecs added, the knight advantage is even -20cps or so, so negative.
with 3 or 4 pieces added, the knight advantage might be as high as 150cps ro so.

5 knightds should be weaker than 2Qs by some 50cps or so.

about 7 knights vs 3 queens we still don't know, but it is most probably draw with perfect play.