Dann Corbit wrote:It seems like a3 may be nearly as good:
Yes I think so, Toga gets scores of +2 or more for a3 in case Bxh6 is not found, that is probably the main reason why there is such a wide variation in solution times. After 1. a3 Ba5 White can play Bxh6 again and if this variation is found, at least for Toga Mara Beta that means Bxh6 as the first move is found a little later. In the instances I tried it even seemed a necessary condition but as I see from Toga CMLX Dann there it is not the case and also not for some other engines, But I do believe this phenomenon sometimes has a big influence even though I do not understand it, the positions are different so not direct transpositions of each other. But maybe the transpositions do have an influence somehow, is it related to some earlier posts about myopic hash effects from Vasik perhaps? I do not understand enough about it.
I am trying some experiments with a new freepasser() function in Toga and, even though there are no passed pawns in this position, two different new versions of freepasser() have very different succes here!
The old freepasser() funtion only gives a bonus in the endgame if the passed pawn can advance one square. I made a separate function that gave a bonus for being able to advance another square forward, called free_second_step(), but maybe because of stupid programming errors or a bad choice for testposition the results were very "noisy" so far. I could see not even a difference if I counted the opposite condition with !free_second_step and hugely increased bonuses from 60 to 600...
So, another try, freepasser() now counts all the squares that the pawn can safely go to in case it could move several squares forward as if it were a Rook. Encountering a blocked field breaks the loop. I borrowed some code from another function to do the counting slightly different because I suspected a bug in the first try. Now all is left is deciding how to award the bonuses, there are many possibilities, like second step is worth more than the first because closer to promotion, but you can also argue it should be less because the pawn needs two tempi to get there. Should one also count the rank that the pawn is on, probably that is good but for how much?
The first version in Build 80 had progressive bigger bonuses for more squares, seemed a little bit better than the standard Toga Mara Build 63, but at 50% of the CPU it still takes 55 minutes to find Bhx6 where Build 63 needs 114 minutes no less, also on half the CPU capacity, I ran the two in parallel.
Second version in Build 81, counts all squares the same but then multiplies the sum with the present rank of the pawn. This I tested with more hashtables and now with 100% CPU, result was maybe a bit worse because the solution was found one ply later 17 plies deep.
Build 81
Code: Select all
// free_passer()
static int free_passer(const board_t * board, int pawn, int colour) {
int me, opp;
int inc;
int to, end;
int move;
int meanfreepath = 0;
ASSERT(board!=NULL);
ASSERT(SQUARE_IS_OK(pawn));
ASSERT(COLOUR_IS_OK(colour));
me = colour;
opp = COLOUR_OPP(me);
inc = PAWN_MOVE_INC(me);
// sq = pawn + inc;
// ASSERT(SQUARE_IS_OK(sq));
// blocked pawn?
inc = PAWN_MOVE_INC(me);
end = PAWN_PROMOTE(pawn,me) + inc;
for (to = pawn+inc; to != end; to += inc) {
ASSERT(SQUARE_IS_OK(to));
if (board->square[to] != Empty) break; // direct blockade
move = MOVE_MAKE(pawn,to);
if (see_move(move,board) < 0) break; // indirect blockade
meanfreepath += 1;
}
return meanfreepath;
}
[d]r4rk1/pp2qpp1/2p1bn1p/8/1bP4Q/5N1P/PPB2PP1/R1BR2K1 w - -
Engine: Toga Mara Beta 6 Build 81 (256 MB)
by Fabien Letouzey, Thomas Gaksch and Tam
9/20 0:00 +0.79 1.a3 Ba5 2.b4 Bc7 3.Bb2 Rad8 4.Re1 Rfe8
5.Bd4 (222.312)
10/24 0:01 +0.84 1.a3 Ba5 2.b4 Bc7 3.Bb2 Rfd8 4.Re1 a5
5.Bxf6 Qxf6 6.Qxf6 gxf6 (534.635) 500
11/39 0:03 +0.72 1.a3 Ba5 2.b4 Bc7 3.Bd3 Rfe8 4.Bd2 Rac8
5.Bc3 Rcd8 6.Bd4 (2.130.007) 527
12/39 0:09 +0.72 1.a3 Ba5 2.b4 Bc7 3.Bb2 Rfe8 4.Re1 Nd7
5.Qd4 Nf6 6.Rad1 h5 (5.142.130) 533
13/42 0:30 +0.87 1.a3 Bc5 2.b4 Bb6 3.Bb2 Rfd8 4.Bd3 Bc7
5.Bd4 a5 6.Rab1 a4 7.Re1 (16.469.718) 543
14/42 1:07 +0.84 1.a3 Bc5 2.b4 Bb6 3.Bb2 a5 4.Rdb1 Ra7
5.b5 cxb5 6.Bxf6 Qxf6 7.Qxf6 gxf6
8.Rxb5 Bc7 9.Bd3 (37.252.762) 550
15/49 2:49 +1.02 1.a3 Bc5 2.Re1 Rad8 3.b4 Bd6 4.Nd4 Bh2+
5.Kh1 Rxd4 6.Qxd4 Bb8 7.Be3 Rd8
8.Qc3 Bc7 9.f4 (95.460.964) 562
16/53 10:25 +2.38 1.a3 Bc5 2.Bxh6 gxh6 3.Qxh6 Rfe8
4.Re1 Bd6 5.Ng5 Bf4 6.Bh7+ Kh8
7.Bf5+ Kg8 8.Rxe6 fxe6 9.Bxe6+ Qxe6
10.Qg6+ Kh8 11.Nf7+ Qxf7 12.Qxf7 Be5
13.Qxb7 Rad8 14.Qxc6 (355.135.567) 567
17/55 15:57 +2.32 1.a3 Bc5 2.Bxh6 gxh6 3.Qxh6 Rfe8
4.Re1 Qf8 5.Qxf6 Qg7 6.Qf4 Rad8
7.Ng5 Rd4 8.Qc1 Qh6 9.b4 Bd6 10.Bh7+ Kh8 (551.639.922) 576
17/66 49:35 +2.73 1.Bxh6 gxh6 2.Qxh6 Rfe8 3.Ng5 Bc5
4.Bh7+ Kh8 5.Bb1+ Kg8 6.Rd2 Rad8
7.Bh7+ Kh8 8.Rxd8 Rxd8 9.Re1 Rd6
10.Nxf7+ Qxf7 11.Bg6+ Nh7 12.Bxf7 Bxf7
13.Qh4 Rd2 (1.736.023.829) 583
18/66 80:35 +2.72 1.Bxh6 gxh6 2.Qxh6 Rfe8 3.Ng5 Bc5
4.Bh7+ Kh8 5.g3 Qf8 6.Qxf6+ Qg7
7.Qf4 Be7 8.Nxe6 fxe6 9.Bc2 Rf8
10.Qe3 Bf6 11.Qxe6 Rae8 12.Qf5 Bxb2
13.Qh5+ Kg8 (2.855.215.578) 590
best move: Bc1xh6 time: 137:57.094 min n/s: 593.870 CPU 100.0% n/s(1CPU): 593.870 nodes: 4.915.400.000
The third version has a regressive count where the first square gets six bonuspoints, the next five points etcetera, multiplied with the constant FreePasser again but I decreased this from 60 to only five because I already start with 6 bonuspoints for the first square. I also multiply this with the rank of the pawn but slightly decreased to (rank - 1).
Build 82
Code: Select all
// free_passer()
static int free_passer(const board_t * board, int pawn, int colour) {
int me, opp;
int inc;
int to, end;
int move;
int meanfreepath = 0;
int teller = 6;
ASSERT(board!=NULL);
ASSERT(SQUARE_IS_OK(pawn));
ASSERT(COLOUR_IS_OK(colour));
me = colour;
opp = COLOUR_OPP(me);
inc = PAWN_MOVE_INC(me);
// sq = pawn + inc;
// ASSERT(SQUARE_IS_OK(sq));
// blocked pawn?
inc = PAWN_MOVE_INC(me);
end = PAWN_PROMOTE(pawn,me) + inc;
for (to = pawn+inc; to != end; to += inc) {
ASSERT(SQUARE_IS_OK(to));
if (board->square[to] != Empty) break; // direct blockade
move = MOVE_MAKE(pawn,to);
if (see_move(move,board) < 0) break; // indirect blockade
meanfreepath += teller;
teller -= 1;
}
return meanfreepath;
}
The final delta-bonus counting gets done here (with the experimental code for free_second_step_commented out):
Code: Select all
// "dangerous" bonus
if (board->piece_size[def] <= 1 // defender has no piece
&& (unstoppable_passer(board,sq,att) || king_passer(board,sq,att))) {
delta += UnstoppablePasser;
} else {
delta += free_passer(board,sq,att) * FreePasser * (rank-1);
/*
if ((rank <= 7) && free_second_step(board,sq,att)) {
delta += FreeSecondStep * rank;
}
*/
}
Now the results were much better even though the position has no passed pawn characteristcs at all! 26 seconds on the Athlon single CPU! Probably not much to go on but better than the 114 minutes I started with
r4rk1/pp2qpp1/2p1bn1p/8/1bP4Q/5N1P/PPB2PP1/R1BR2K1 w - -
Engine: Toga Mara Beta 6 Build 82 (Athlon 2009 MHz, 256 MB)
by Fabien Letouzey, Thomas Gaksch and Tam
9/20 0:00 +0.79 1.a3 Ba5 2.b4 Bc7 3.Bb2 Rad8 4.Re1 Rfe8
5.Bd4 (222.285)
10/24 0:01 +0.84 1.a3 Ba5 2.b4 Bc7 3.Bb2 Rfd8 4.Re1 a5
5.Bxf6 Qxf6 6.Qxf6 gxf6 (534.572) 500
11/40 0:04 +0.84 1.a3 Ba5 2.Bxh6 gxh6 3.Qxh6 c5 4.b4 Bc7
5.Ng5 Rad8 6.Bh7+ Kh8 7.Be4+ Kg8 (2.490.125) 533
12/41 0:08 +0.78 1.a3 Ba5 2.Bxh6 gxh6 3.Qxh6 c5 4.b4 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