Idea for recognizing fortress/encouraging progress

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Idea for recognizing fortress/encouraging progress

Post by Sven »

Evert wrote:
Sven Schüle wrote: I would vote for a static eval approach in a way that helps to assign a static eval of 0 to special pawn chain positions like the one above, so that search can easily find the queen sac that breaks the pawn chain.

A possible idea would be to write code that detects whether an own piece would ever be able to "cross the pawn chain" and attack targets like undefended enemy pawns (e.g. a2 in the position above) or the enemy king, under the basic assumption that the pawn chain remains unchanged. The black bishop as well as both black rooks are definitely unable to cross the chain: there is no "hole" for the bishop to slip through, and there is also no open or semi-open file for the rooks, and the pawn chain is fully connected. For this reason the black bishop and rooks would have to be evaluated as "zero" (i.e., no material or positional value) since they serve for exactly nothing at the moment. The white bishop also gets "zero" of course. In principle the same holds for the black queen as well except for its ability to attack enemy pawns. But the queen should be evaluated as "zero" as well since otherwise the basic idea would not work.

The definition of a "pawn chain" might even be generalized a bit since each of the enemy pawns could be replaced by any other enemy piece. The key point is to detect whether a given piece (QRBN) "serves for nothing" since its "mobility" is restricted to an "unimportant" area of the board.

The idea can also be extended to knights although these might be able to jump across the chain. Usually they can't do so without being subject to immediate capture in case of a fully connected pawn chain. But here some more thoughts may be needed how to handle knights.

What do others think about that approach? It sounds expensive, of course, but maybe there are some simple bitboard tricks that help to drastically restrict the number of cases where such expensive calculation would be applied. The benefit would be to find the "breaking sac" very quickly through search.
I would use "number of blocked pawns" as a metric. That is: how many pawns are unable to advance (because they are blocked or would be captured immediately)? The larger this number, the more draw-like the position becomes. Then simply scale the evaluation (the factor could be taken from a table indexed by number of blocked pawns); the scale would be 1 if there are few blocked pawns and become 0 (or close to it) if there are 16 blocked pawns in total. The transition should probably be quite sharp.

This is a crude approximation of course; the files on which the pawns are blocked are important as well, but all that's really needed is to guide the search in the right direction.

I suspect it may help as "anti-human" chess as well, but overall it's probably wasted effort. I think Crafty used to have similar code in older versions.
But this scaling approach does not help much in locked positions in my opinion since it still maintains a slight advantage for the side with more material, leading to huge, almost endless piece shuffling sequences. My proposal is different: don't just state a vague "the position seems to be drawish" but evaluate it to 0 if there is no piece on either side that can actually do anything useful as long as the pawn chain remains intact.

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

Re: Idea for recognizing fortress/encouraging progress

Post by hgm »

Usually it is bad to evaluate drawn positions as exactly zero, as there are nearly won draw positions as well as nearly lost draw positions. And it pays to be able to distinguish the two.

I don't understand your argument. It is scores that are exactly zero that lead to endless shuffling, as the pieces will diffuse randomly over the board. And the whole point is to have the leading engine avoid that the position can be closed, not what happens after it is closed. This is why using the 50-move counter to detect it is pointless.

I expect Evert's suggestion to work very well. The drawishness correction is probably only needed with >=6 bloacked Pawns. This need not be very expensive. The Pawn hash can contain a 2-bit field to signal <6, 6, 7 or 8 blocked Pawns. In most positions it would be set to <6, and the overhead remains limited to testing the field. Only when it specifies >= 6 you would call an extra evaluation routine to determine the scaling, based on present piece types.

And if you start in a locked position, and are enough ahead to 'sacrifice yourself out of the cage', the search will find that, and the evaluation will jump up by the sacrifice because the discount is no longer applied, or strongly reduced. Sacrificing Q in the position of the OP will raise the score from +5+5+9 = +19 discounted by a factor 16 (say) for 8 blocked Pawns (so +1.2) to +5+5+1 = +11 discounted by only a factor 1.5 (because only 6 blocked Pawns, an open file, and a strong Rook majority), i.e. +7. A huge incentive for the Q sac.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Idea for recognizing fortress/encouraging progress

Post by Evert »

Sven Schüle wrote: But this scaling approach does not help much in locked positions in my opinion since it still maintains a slight advantage for the side with more material,
But that's what you want: supposing that you cannot say with 100% certainty that the position is a draw, then the position is most likely best for the side that has the option of making a sacrifice to open it up.
leading to huge, almost endless piece shuffling sequences.
Not if opening the position is worth more than the sacrifice, which is a matter of setting the scale factor appropriately.
My proposal is different: don't just state a vague "the position seems to be drawish" but evaluate it to 0 if there is no piece on either side that can actually do anything useful as long as the pawn chain remains intact.
But that comes down to the same thing: the position is just scaled to 0 in that case. I have a superstition that it's dangerous to collapse the score completely to 0 though; I only do that if I know the position is a draw (for instance the Philidor position in KRPKR), otherwise I divide the score by a constant (or discard the material component of the evaluation).

I implemented (as a quick hack) the idea in Jazz as follows:

Code: Select all

  bitboard_t bb = board->bbp&#91;PAWN&#93; & board->bbc&#91;game->side_to_move>>7&#93;;
   if &#40;game->side_to_move == WHITE&#41;
      bb &= south_pawn_step&#40;board->bbp&#91;PAWN&#93; & board->bbc&#91;1&#93;);
   else
      bb &= north_pawn_step&#40;board->bbp&#91;PAWN&#93; & board->bbc&#91;0&#93;);
   int psf&#91;&#93; = &#123; 64, 64, 64, 64, 64, 64, 32, 16, 1 &#125;;
   ev = &#40;ev * psf&#91;popcount64&#40;bb&#41;&#93;) / 64;
so the score gets severely depressed if all 8 pawns are blocked and progressively less so if there are fewer blocked pawns. The original evaluation of the posted position (after moving the queen to g8, which I understood from he discussion was the intention) is

Code: Select all

&#91; 1&#93;  +23.03    0.00       16   &#40;EBR =  0.00&#41;     0 / 0   1. ... Bb6  
&#91; 2&#93;  +22.94    0.00       75   &#40;EBR =  0.87&#41;     2 / 0   1. ... Ra8   2. Bh1   
&#91; 3&#93;  +23.01    0.00      164   &#40;EBR =  1.30&#41;     3 / 0   1. ... Ra8   2. Bh1   Rb8   
&#91; 4&#93;  +22.99    0.00      630   &#40;EBR =  4.01&#41;     4 / 0   1. ... Ra8   2. Bh1   Rb8   3. Kd3   
&#91; 5&#93;  +23.03    0.00     1510   &#40;EBR =  1.28&#41;     5 / 0   1. ... Ra8   2. Bh1   Rb8   3. Kd3   Qh8   
&#91; 6&#93;  +23.03    0.01     2829   &#40;EBR =  1.30&#41;     6 / 0   1. ... Ra8   2. Bh1   Rb8   3. Kd3   Qh8   4. Ke4   
&#91; 7&#93;  +23.06    0.01     5468   &#40;EBR =  1.38&#41;     7 / 0   1. ... Ra8   2. Bh1   Rb8   3. Kd3   Qh8   4. Ke4   Bc7   
&#91; 8&#93;  +23.06    0.02    10454   &#40;EBR =  1.03&#41;     8 / 0   1. ... Ra8   2. Bh1   Rb8   3. Kd3   Qh8   4. Ke4   Bc7   5. Kd3   
&#91; 9&#93;  +23.09    0.02    20359   &#40;EBR =  1.43&#41;     9 / 0   1. ... Ra8   2. Bh1   Rb8   3. Kd3   Qh8   4. Ke4   Bc7   5. Kd3   Ka5   
&#91;10&#93;  +23.09    0.03    42100   &#40;EBR =  2.23&#41;    10 / 0   1. ... Ra8   2. Bh1   Rb8   3. Kd3   Qh8   4. Ke4   Bc7   5. Kd3   Ka5   6. Ke4   
&#91;11&#93;  +23.08    0.05    81378   &#40;EBR =  1.48&#41;    11 / 0   1. ... Ra8   2. Bh1   Rb8   3. Kd3   Qh8   4. Ke4   Bc7   5. Kd3   Ka5   6. Ke4   Kb6   
&#91;12&#93;  +23.09    0.09   162292   &#40;EBR =  2.02&#41;    12 / 0   1. ... Ra8   2. Bh1   Rb8   3. Kd3   Qh8   4. Ke4   Kb6   5. Kd3   Kc7   6. Ke3   Bb6   7. Ke4   
&#91;13&#93;  +23.11    0.17   387920   &#40;EBR =  2.39&#41;    13 / 0   1. ... Ra8   2. Bh1   Ra7   3. Kd3   Qh8   4. Kc2   Rc8   5. Kd3   Bc7   6. Kd2   Ra8   7. Kd3   Kb6   
&#91;14&#93;  +23.11    0.29   631859   &#40;EBR =  1.34&#41;    14 / 0   1. ... Ra8   2. Bh1   Ra7   3. Kd3   Qh8   4. Kc2   Rc8   5. Kd3   Bc7   6. Kd2   Ra8   7. Kd3   Kb6   8. Ke4   
&#91;15&#93;  +23.10    0.58  1428102   &#40;EBR =  2.49&#41;    15 / 0   1. ... Ra8   2. Bh1   Ra7   3. Kd3   Qh8   4. Kc2   Rc8   5. Kd3   Bc7   6. Kd2   Ra8   7. Kd3   Kb6   8. Ke3   Ka5   
<16>            1.03  2623463  +23.10 -> +23.11  16 / 0   1. ... Ra8   2. Bh1   Ra7   3. Kd3   Qh8   4. Kc2   Rc8   5. Kd3   Bc7   6. Kd2   Ra8   7. Kd3   Kb6   8. Ke3   Ka5   9. Kd3   
&#91;16&#93;  +23.11    1.16  2941829   &#40;EBR =  2.01&#41;    16 / 0   1. ... Rc8   2. Bh1   Qh8   3. Kd2   Ra8   4. Kc1   Rd8   5. Bg2   Ra7   6. Kd1   Rf8   7. Ke2   Ra8   8. Bh1   Bb6   9. Be4   
&#91;17&#93;  +23.11    2.08  5272924   &#40;EBR =  1.56&#41;    15 / 0   1. ... Rc8   2. Bh1   Qh8   3. Kd2   Bc7   4. Kc1   Ra8   5. Kb1   Re8   6. Be4   Ba5   7. Bh1   Rb8   8. Kc2   Bb6   
&#91;18&#93;  +23.10    3.73  9317786   &#40;EBR =  1.81&#41;    17 / 0   1. ... Rc8   2. Bh1   Qh8   3. Kd2   Bc7   4. Kc1   Ra8   5. Kb1   Re8   6. Be4   Ba5   7. Bh1   Rf8   8. Kc2   Ra7   9. Kd2   Ra8   
&#91;19&#93;  +23.11    8.82 20152930   &#40;EBR =  3.07&#41;    19 / 0   1. ... Rc8   2. Bh1   Qh8   3. Kd2   Bc7   4. Kc1   Ra8   5. Kb1   Re8   6. Be4   Ka5   7. Bh1   Rb8   8. Kc2   Ra7   9. Kd2   Ra8   10. Ke3   Kb6   
&#91;20&#93;  +23.11   24.12 49000404   &#40;EBR =  3.01&#41;    20 / 0   1. ... Rc8   2. Bh1   Qh8   3. Kd2   Bc7   4. Kc1   Ra8   5. Kb1   Re8   6. Be4   Ka5   7. Bh1   Rb8   8. Kc2   Ra7   9. Kd2   Kb6   10. Kd3   Ra8   11. Ke4   
In other words, completely clueless. With the "fortress scaling":

Code: Select all

&#91; 1&#93;   +3.54    0.00       12   &#40;EBR =  0.00&#41;     0 / 0   1. ... Qxe6 
&#91; 2&#93;   +3.54    0.00       43   &#40;EBR =  0.66&#41;     2 / 0   1. ... Qxe6  2. fxe6  
&#91; 3&#93;   +3.55    0.00      153   &#40;EBR =  2.01&#41;     3 / 0   1. ... Qxe6  2. fxe6  Bc7   
< 4>            0.00     1678   +3.51 ->  +3.53   4 / 0   1. ... Qxe6  2. fxe6  Bc7   3. Bf5   
< 4>            0.01     2644   +3.53 ->  +3.54   4 / 0   1. ... Qf7   2. Ke3   Qxe6  3. fxe6  
&#91; 4&#93;   +3.54    0.01     3688   &#40;EBR = 12.69&#41;     4 / 0   1. ... Bb6   2. Ke3   Qxe6  3. fxe6  
&#91; 5&#93;   +3.55    0.01     5132   &#40;EBR =  0.20&#41;     5 / 0   1. ... Bb6   2. Ke3   Qxe6  3. fxe6  Ka5   
&#91; 6&#93;   +3.56    0.02    13055   &#40;EBR =  5.25&#41;     7 / 0   1. ... Bb6   2. Ke3   Ra8   3. Bh1   Qxe6  4. dxe6  Rb8   
< 7>   !!!      0.03    24505   +3.56 ->  +5.67   7 / 0   1. ... Bb6   2. Kd1   Ra8   3. Ke1   Qxe6  4. dxe6  Rb8   
&#91; 7&#93;   +5.67    0.03    25474   &#40;EBR =  1.18&#41;     7 / 0   1. ... Qxe6  2. fxe6  f5    3. Bxf5  Rxf5  4. gxf5  g4    
&#91; 8&#93;   +6.11    0.03    31085   &#40;EBR =  0.39&#41;     8 / 0   1. ... Qxe6  2. fxe6  f5    3. Bxf5  Rxf5  4. Ke3   Rxd5  5. cxd5  
&#91; 9&#93;   +6.28    0.04    43274   &#40;EBR =  2.13&#41;     9 / 0   1. ... Qxe6  2. fxe6  f5    3. Bxf5  Rxf5  4. Ke3   Rxd5  5. cxd5  Rf8   
<10>   !!!      0.06    69415   +6.28 ->  +7.37  11 / 0   1. ... Qxe6  2. dxe6  d5    3. Bd3   dxc4  4. Bxc4  Kb7   5. Bd3   Bc7   6. Be4   Kb6   
&#91;10&#93;   +7.37    0.08    88987   &#40;EBR =  5.01&#41;    11 / 0   1. ... Qxe6  2. dxe6  d5    3. Bd3   dxc4  4. Bxc4  Kb7   5. Bd3   Bc7   6. Be4   Kb6   
<11>   !!!      0.13   158907   +7.37 ->  +9.40  11 / 0   1. ... Qxe6  2. fxe6  f5    3. Bxf5  Rxf5  4. Kd3   Rf2   5. Ke4   Rd2   6. Ke3   Rxa2  
&#91;11&#93;   +9.40    0.14   181186   &#40;EBR =  1.64&#41;    11 / 0   1. ... Qxe6  2. fxe6  f5    3. Bxf5  Rxf5  4. Kd3   Rf2   5. Ke4   Rd2   6. Ke3   Rxa2  
&#91;12&#93;   +9.67    0.23   316991   &#40;EBR =  1.47&#41;    12 / 0   1. ... Qxe6  2. dxe6  d5    3. Bd3   Kb6   4. Ke1   dxc4  5. Bxc4  Rd4   6. Bf1   Rxg4  7. hxg4  
&#91;13&#93;   +9.91    0.33   509108   &#40;EBR =  1.16&#41;    14 / 0   1. ... Qxe6  2. dxe6  d5    3. Bd3   dxc4  4. Bxc4  Kb6   5. Ke3   Rd4   6. Bf1   Rh8   7. Bg2   Rxg4  8. hxg4  
&#91;14&#93;  +10.16    0.54   915153   &#40;EBR =  1.97&#41;    14 / 0   1. ... Qxe6  2. fxe6  f5    3. Bf3   fxg4  4. Bxg4  Rf4   5. Ke1   Rf8   6. Be2   Re4   7. Kd2   Rxe6  8. dxe6  
<15>   !!!      0.89  1596838  +10.16 -> +10.91  15 / 0   1. ... Qxe6  2. fxe6  f5    3. Bxf5  Rxf5  4. gxf5  Rf8   5. Kf3   Rxf5  6. Ke2   Rf6   7. Ke3   g4    8. hxg4  h3    
&#91;15&#93;  +10.91    1.38  2325452   &#40;EBR =  4.05&#41;    15 / 0   1. ... Qxe6  2. fxe6  f5    3. Bxf5  Rxf5  4. gxf5  Rf8   5. Kf3   Rxf5  6. Ke2   Rf6   7. Ke3   g4    8. hxg4  h3    
<16>   !!!      1.98  3673250  +10.91 -> +12.27  16 / 0   1. ... Qxe6  2. fxe6  f5    3. gxf5  g4    4. hxg4  Rg8   5. Kf3   Rf8   6. Kf4   h3    7. Kg3   h2    8. Kxh2  Rxg4  9. Bf3   
&#91;16&#93;  +12.27    2.41  4472956   &#40;EBR =  1.24&#41;    16 / 0   1. ... Qxe6  2. fxe6  f5    3. gxf5  g4    4. hxg4  Rg8   5. Kf3   Rf8   6. Kf4   h3    7. Kg3   h2    8. Kxh2  Rxg4  9. Bf3   
&#91;17&#93;  +12.51    3.90  7413461   &#40;EBR =  1.44&#41;    18 / 0   1. ... Qxe6  2. fxe6  f5    3. gxf5  g4    4. hxg4  Rg8   5. f6    exf6  6. Kf3   Rh8   7. Kg2   h3    8. Kh2   Re8   9. Bf5   Re7   10. Be4   
&#91;18&#93;  +12.48    7.76 14767213   &#40;EBR =  2.59&#41;    18 / 0   1. ... Qxe6  2. fxe6  f5    3. gxf5  g4    4. hxg4  h3    5. g5    h2    6. f6    exf6  7. e7    fxg5  8. exf8Q Rxf8  9. Ke3   Rh8   10. Kd2   
&#91;19&#93;  +12.58   17.90 34857483   &#40;EBR =  2.63&#41;    20 / 0   1. ... Qxe6  2. fxe6  f5    3. gxf5  Kb7   4. Kf3   g4    5. hxg4  Rh8   6. Kg2   h3    7. Kh2   Rg8   8. Bf3   Rg7   9. Bd1   Bb6   10. Bf3   Kc7   11. Kg3   
<20>   !!!     24.21 45550720  +12.58 -> +13.28  20 / 0   1. ... Qxe6  2. fxe6  f5    3. gxf5  g4    4. hxg4  h3    5. g5    Re8   6. Kf1   h2    7. Kg2   Rh8   8. Kh1   Rg8   9. g6    Rg7   10. f6    exf6  11. Bf5   
&#91;20&#93;  +13.28   32.65 59011838   &#40;EBR =  1.46&#41;    20 / 0   1. ... Qxe6  2. fxe6  f5    3. gxf5  g4    4. hxg4  h3    5. g5    Re8   6. Kf1   h2    7. Kg2   Rh8   8. Kh1   Rg8   9. g6    Rg7   10. f6    exf6  11. Bf5   
syzygy
Posts: 5569
Joined: Tue Feb 28, 2012 11:56 pm

Re: Idea for recognizing fortress/encouraging progress

Post by syzygy »

This position is a nice example of the fact that a completely locked position should not be evaluated as a draw. White might have sacrificed material in order to get this blocked position that it thinks is a draw, but in reality is completely lost.

It seems better to subtract at most the value of the least valuable piece that could break the chain minus a pawn.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Idea for recognizing fortress/encouraging progress

Post by Sven »

hgm wrote:Usually it is bad to evaluate drawn positions as exactly zero, as there are nearly won draw positions as well as nearly lost draw positions. And it pays to be able to distinguish the two.

I don't understand your argument. It is scores that are exactly zero that lead to endless shuffling, as the pieces will diffuse randomly over the board. And the whole point is to have the leading engine avoid that the position can be closed, not what happens after it is closed. This is why using the 50-move counter to detect it is pointless.

I expect Evert's suggestion to work very well. The drawishness correction is probably only needed with >=6 bloacked Pawns. This need not be very expensive. The Pawn hash can contain a 2-bit field to signal <6, 6, 7 or 8 blocked Pawns. In most positions it would be set to <6, and the overhead remains limited to testing the field. Only when it specifies >= 6 you would call an extra evaluation routine to determine the scaling, based on present piece types.

And if you start in a locked position, and are enough ahead to 'sacrifice yourself out of the cage', the search will find that, and the evaluation will jump up by the sacrifice because the discount is no longer applied, or strongly reduced. Sacrificing Q in the position of the OP will raise the score from +5+5+9 = +19 discounted by a factor 16 (say) for 8 blocked Pawns (so +1.2) to +5+5+1 = +11 discounted by only a factor 1.5 (because only 6 blocked Pawns, an open file, and a strong Rook majority), i.e. +7. A huge incentive for the Q sac.
Without the queen the example position would be an exact draw. With the queen it remains draw unless the queen is sacrificed. Evaluating as 0 seems to fit best to this situation in my opinion. The queen sac will be found as best move very early since after the queen sac the position evaluates to roughly two rooks vs. a bishop up (the black bishop still being "useless"). Scaling down based on the degree of "lockedness" of the position does not appear attractive to me here, it may be very imprecise. In fact it might also apply to a somewhat smaller degree to the position after the queen sac, leading to the wrong decision to prefer the position without sac due to the presence of the queen material.

My proposal only works in cases where you can be 100% sure that a piece has zero effect with the current pawn structure. If that does not apply then scaling is of course better. But then I would apply scaling to each single piece (QRBN), not to the whole position value.

YMMV of course.

EDIT: In the given example the point for me is not to find out that the position is really won, but to find the PV much more quickly. Scaling down the whole eval will not help to identify the queen sac as the best move, at least during the first many iterations.

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

Re: Idea for recognizing fortress/encouraging progress

Post by hgm »

But what earns you most points is not to be able to get out of such positions, but to avoid getting into them. The given position is of course ridiculous and would never occur in practice. How in the World could one side get an advantage this large after closing the position, or why would it have preferred to allow closing the position in stead of using its QRR advantage to mate the opponent?

In your proposal, at the point where closing seems to be inevitable, but not yet a fact, it would be just as happy with a position where it does not have the two Rooks. And then later, when the position is closed, and it can look far enough ahead to see how it can re-open it, it would have to decide against it, because without the two Rooks there wouldn't be any advantage left.

It is always a bad idea to score material that would conceivably become useful as 0.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Idea for recognizing fortress/encouraging progress

Post by Evert »

Sven Schüle wrote: Without the queen the example position would be an exact draw. With the queen it remains draw unless the queen is sacrificed. Evaluating as 0 seems to fit best to this situation in my opinion.
Using that logic, KQK is a draw unless you actually give mate.

The position is not a draw because of the presence of the queen, so evaluating it as such isn't correct. What is correct is that the position after the queen sacrifice should be evaluated as better than the position before the sacrifice. That is really the most important point.
The queen sac will be found as best move very early since after the queen sac the position evaluates to roughly two rooks vs. a bishop up (the black bishop still being "useless").
Well, with the scaling Jazz finds Qxe6 as best move at ply 1 (it then switches to another move with Qxe6 as a second move for a few ply before switching back to Qxe6)...
Scaling down based on the degree of "lockedness" of the position does not appear attractive to me here, it may be very imprecise. In fact it might also apply to a somewhat smaller degree to the position after the queen sac, leading to the wrong decision to prefer the position without sac due to the presence of the queen material.
Depends on how much you scale by - and you can scale it to 0 if you want. What you need is eval(position after sacrifice) > eval(position before sacrifice). The difference in material value between the two is a queen (going the other way), so the scaling has to be large enough to compensate for that.
My proposal only works in cases where you can be 100% sure that a piece has zero effect with the current pawn structure. If that does not apply then scaling is of course better.
Ok, if you can proof that the position is a draw, there is of course no problem with returning a draw score. However, there is a cost associated with that and it's for sure faster to simply scale if the position is "drawish or draw" than it is to distinguish between "drawish" and "draw" and it's not obvious (to me) that the program would play differently.
But then I would apply scaling to each single piece (QRBN), not to the whole position value.
I don't understand. The position evaluation is the sum of piece-specific terms. How is scaing each of those independently different from just scaling the whole thing?
EDIT: In the given example the point for me is not to find out that the position is really won, but to find the PV much more quickly. Scaling down the whole eval will not help to identify the queen sac as the best move, at least during the first many iterations.
As I said, Jazz picks it at ply=1...
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Idea for recognizing fortress/encouraging progress

Post by Don »

hgm wrote:But what earns you most points is not to be able to get out of such positions, but to avoid getting into them. The given position is of course ridiculous and would never occur in practice. How in the World could one side get an advantage this large after closing the position, or why would it have preferred to allow closing the position in stead of using its QRR advantage to mate the opponent?

In your proposal, at the point where closing seems to be inevitable, but not yet a fact, it would be just as happy with a position where it does not have the two Rooks. And then later, when the position is closed, and it can look far enough ahead to see how it can re-open it, it would have to decide against it, because without the two Rooks there wouldn't be any advantage left.

It is always a bad idea to score material that would conceivably become useful as 0.
There is no simple rule that will cure blocked positions. We did the pawn "ram" thing, counting the number of pawns that were butting heads and using this as a drawishness coefficient, and that just weakened the program and we experimented with all sorts of variations of it and curves and values. So the issue is to determine WHY such a thing does makes it weaker and improve the definition and it will take a lot of work.

I think 90% of closed position handling is understanding pawn breaks and how to prepare them. As a general rule a pawn break is good only if it improves the position but it's obvious to me that programs are not judging the position after the break very well or else we would see much improved closed position handling.
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
User avatar
hgm
Posts: 27837
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Idea for recognizing fortress/encouraging progress

Post by hgm »

I don't think it is bad if this requires a complex algorithm. As long as it is not invoked needlessly. In my proposal the simplistic head-to-head counting would only be used only as a filter, to cheaply exclude positions where no subtlety is called for. As this goes through Pawns structure, the cost of deciding in a more precise way which structures can be opened easily (by Pawn moves alone) will be negligible anyway, because it is hashed in the Pawn hash with a large hit rate. Only positions with Pawn structures flagged there as 'dangerous' would invoke the complex algorithm. But for such positions that is really worthwhile, because otherwise they would be completely mis-evaluated.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Idea for recognizing fortress/encouraging progress

Post by Don »

hgm wrote:I don't think it is bad if this requires a complex algorithm. As long as it is not invoked needlessly. In my proposal the simplistic head-to-head counting would only be used only as a filter, to cheaply exclude positions where no subtlety is called for. As this goes through Pawns structure, the cost of deciding in a more precise way which structures can be opened easily (by Pawn moves alone) will be negligible anyway, because it is hashed in the Pawn hash with a large hit rate. Only positions with Pawn structures flagged there as 'dangerous' would invoke the complex algorithm. But for such positions that is really worthwhile, because otherwise they would be completely mis-evaluated.
There was a position posted here where a queen sacrifce was need to open up the locked pawns, all 8 pawns from each army were deadlocked. In the position white was up something like a queen and rook but had to be willing to give up a lot. No program is likely to do that on it's own without some sort of understanding (or threat of 50 move draw) or a deep enough search to see the realization of a win, but even a promotion is not enough to see that it's a win.

I hacked a version of Komodo to count the locked pawns and if all 8 were locked, then multiple the score by some fraction such as 0.2 (I don't remember the exact fraction) and the program was easily able to solve this position. However, when tested with 100,000 games it consistently played weaker. Not by much, but by a little.

But even if that had worked perfectly, it's just a small subset of closed position handling. A hack to make it solve that position is all well and good but that is a pretty rare situation. When making the rule I also experimented with giving higher coefficients to the 7 and 6 pawn case but to no avail. I think doing this "right" is a lot more complicated than just putting together a simple minded kludge like this.
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.