Old testposition I posted revisited...

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

Moderator: Ras

User avatar
Eelco de Groot
Posts: 4669
Joined: Sun Mar 12, 2006 2:40 am
Full name:   Eelco de Groot

Old testposition I posted revisited...

Post by Eelco de Groot »

..but it's not for Rybka that will find it fast, and the position is also from a game against Rybka, Rybka 2.2n2 the free version. Ancalagon can only find the move stably after a few minutes, and that is after I increased the value for an open rookfile from Stockfish's value 43 to 50.

Code: Select all

  // Rooks on open files
  const Value RookOpenFileBonus = Value(50);
Maybe 50 is too much, but it seemed the simplest method to get that rook on e8 where it belongs :) Ancalagon was thinking ages about the 27... Re8 move but rejecting it twice while Rd7 slowly sank further - I think that move loses-, so I knew just a little push might help the right move over the alpha-testedge

[d]3r1k2/p5pp/n1NP1p2/1NbB1b2/5P2/1P6/5P1P/5RK1 b - - bm Re8; id "critical defence 001 am 27...Rd7"; c0 "Rybka 2.2n2-Blueberry Beta4 Build 375 10-03-2009";

3r1k2/p5pp/n1NP1p2/1NbB1b2/5P2/1P6/5P1P/5RK1 b - -

Engine: Ancalagon 1.3 WS180 [new] Build 98 (Athlon 2009 MHz, 256 MB)
by Romstad, Costalba, Kiiski, de Groot

2.00 0:00 -0.70 1...Rd7 2.Ra1 (936) 4

3.00 0:00 -0.52 1...Rd7 2.Ra1 Nb4 (15.602) 66

4.00 0:00 +0.07 1...Rd7 2.Re1 Bxd6 3.Nxd6 Rxd6 (52.836) 177

5.00 0:00 +0.31 1...Rd7 2.Ra1 Nb4 3.Bg2 Nxc6 4.Bxc6 (125.903) 335

6.00 0:00 -0.76 1...Rd7 2.Rc1 (183.512) 405

7.00 0:00 -1.25 1...Rd7 2.Rc1 Bd3 3.Ncxa7 Bg6 4.Nc8 Bd3
5.Bc6 (583.389) 602

8.01 0:01 -1.25 1...Rd7 2.Rc1 Bd3 3.Ncxa7 Bg6 4.Nc8 Bd3
5.Bc6 (945.060) 687

9.01 0:02 -1.15 1...Rd7 2.Rc1 Bb6 3.b4 Bd3 4.B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 12.Bxh7 (484.837.451) 908

19.01 33:07 -1.33 1...Re8 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Rxa7 Bh3
5.Rf7+ Kg8 6.Rc7+ Kh8 7.f3 Rb8 8.Bb7 Rd8
9.Rc4 Bxd6 10.Nxd6 Rxd6 11.Bc8 f5
12.b4 Rd2 13.b5 Rg2+ 14.Kh1 Rb2 (1.741.452.104) 876

20.01 50:05 -1.27 1...Re8 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Rxa7 Bh3
5.Rf7+ Kg8 6.Rc7+ Kh8 7.f3 Rb8 8.Bb7 Rd8
9.Kf2 Be6 10.Kg2 Bxb3 11.Rc8 Rxc8
12.Bxc8 Kg8 13.d7 Be7 14.Kg3 (2.628.489.771) 874

21.01 88:30 -1.27 1...Re8 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Rxa7 Bh3
5.Rf7+ Kg8 6.Rc7+ Kh8 7.f3 Rb8 8.Bb7 Rd8
9.Rc4 Bxd6 10.Nxd6 Rxd6 11.Bc8 f5
12.Kf2 Rd2+ 13.Ke3 Rxh2 14.Rc7 g6 (4.640.418.577) 873

best move: Rd8-e8 time: 112:41.219 min n/s: 877.465 nodes: 5.932.710.462


Are there programs out there that will find it as fast as Rybka does? I think it is the only saving move in a difficult position. I wrote before that I intended to make a testsuite with these kinds of positions but I don't really seem to have enough time for playing testgames and then finding some critical positions in them, my excuse is programming is too difficult to do that kind of rigorous testing as well... It would be a good practice though, also for myself because it trains you in analysis and allows you to concentrate hopefully some chess knowedge both for your program or yourself if you want to improve chess-skills, condensed in a single position to remember. But so far I have only 'Critical defence 001' :lol:

Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
kgburcham
Posts: 2016
Joined: Sun Feb 17, 2008 4:19 pm

Re: Old testposition I posted revisited...

Post by kgburcham »

[d] 3r1k2/p5pp/n1NP1p2/1NbB1b2/5P2/1P6/5P1P/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5       0.1    -0.23  Rd7 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Bc6
     17966   5:      0.2    -0.23  Rd7 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Bc6
     27851   6       0.3    -0.43  Rd7 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Bc6 Rd8
                                   5.Rxa7 Bxd6 6.Nxd6 Rxd6
     50593   6:      0.5    -0.43  Rd7 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Bc6 Rd8
                                   5.Rxa7 Bxd6 6.Nxd6 Rxd6
     68984   7       0.7    -0.43  Rd7 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Bc6 Rd8
                                   5.Rxa7 Bxd6 6.Nxd6 Rxd6
    128106   7:      1.1    -0.43  Rd7 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Bc6 Rd8
                                   5.Rxa7 Bxd6 6.Nxd6 Rxd6
    232209   8       1.6      :-(  Rd7
    429388   8       2.2      :-(  
    515397   8       2.5    -1.07  Rd7 2.Rc1 Bxd6 3.Ncd4 Bc7 4.Be6 Rxd4
                                   5.Nxd4 Bxf4
    765511   8:      3.2    -1.07  Rd7 2.Rc1 Bxd6 3.Ncd4 Bc7 4.Be6 Rxd4
                                   5.Nxd4 Bxf4
    943992   9       3.7    -1.07  Rd7 2.Rc1 Bxd6 3.Ncd4 Bc7 4.Be6 Rxd4
                                   5.Nxd4 Bxf4
   1434055   9:      5.3    -1.07  Rd7 2.Rc1 Bxd6 3.Ncd4 Bc7 4.Be6 Rxd4
                                   5.Nxd4 Bxf4
   1873511  10       6.6      :-(  Rd7
   3589454  10      12.1    -1.18  Re8 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Rxa7 Bh3
                                   5.Rf7+ Kg8 6.Re7+ Kf8 7.Bg2 Bg4 8.h3
                                   Bf5
   4645755  10:     15.3    -1.18  Re8 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Rxa7 Bh3
                                   5.Rf7+ Kg8 6.Re7+ Kf8 7.Bg2 Bg4 8.h3
                                   Bf5
   9081130  11      29.1    -0.85  Re8 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Rxa7 Bh3
                                   5.Rf7+ Kg8 6.Rc7+ Kh8 7.f3 Rb8 8.Bc4
                                   Bd2 9.Kf2 Bxf4
  11717706  11:     36.7    -0.85  Re8 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Rxa7 Bh3
                                   5.Rf7+ Kg8 6.Rc7+ Kh8 7.f3 Rb8 8.Bc4
                                   Bd2 9.Kf2 Bxf4
  23668131  12      73.0    -0.96  Re8 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Rxa7 Bh3
                                   5.Rf7+ Kg8 6.Rc7+ Kh8 7.f3 Rb8 8.Bc4
                                   Rd8 9.Kf2 Bd7 10.Ke3 Bxb5 11.Bxb5 Bxd6
  34240774  12:    103.0    -0.96  Re8 2.Ra1 Nb4 3.Nxb4 Bxb4 4.Rxa7 Bh3
                                   5.Rf7+ Kg8 6.Rc7+ Kh8 7.f3 Rb8 8.Bc4
                                   Rd8 9.Kf2 Bd7 10.Ke3 Bxb5 11.Bxb5 Bxd6
User avatar
Eelco de Groot
Posts: 4669
Joined: Sun Mar 12, 2006 2:40 am
Full name:   Eelco de Groot

Re: Old testposition I posted revisited...

Post by Eelco de Groot »

Thanks guys for trying the position! Impressively done by Gaviota and Cyclone 3.0!

So it seems that Rybka is not unique for finding this but seems simply alround good in finding these kind of prophylactic moves, actually this is more a last ditch defence of course and Rybka's prophylaxis would have never steered to such a position in the first place.

I maybe managed to improve Ancalagon's search just a bit but only tested in this position, I think one of the difficulties is that Glaurung gives a penalty if there are blocking pieces in front of a passed pawn, so moving the Rook to another file is discouraged especially with the pawn already advanced to the sixth rank. But the Rook here when on d7 is under the attack of those two Knights and the passed pawn is suficiently controlled by the white squared Bishop attacking the square directly in front of it, and one Knight, that could possibly challenge control of the square can't move because it has to defend the pawn from attack by the other, dark squared, Bishop from Black. So simplifying to the extreme you might say that Black's Bishop pair is possibly just barely enough to counter the advantage of a plus passed pawn that is so far advanced and even seemingly supported by the white Knights.

I tried to modify Glaurung's code for this kind of passed pawn where a blocking piece is not necessary and probably even dangerous to try, as d7 is not a safe square for the Rook. I was lucky that it really had an effect as predicted.

This is the codeblock that specifically handles the passed pawn with no Rook or with Rook in front of it:

Code: Select all

                    if ((b2 & pos.pieces_of_color(them)) == EmptyBoardBB)
                    {
                        // There are no enemy pieces in the pawn's path! Are any of the
                        // squares in the pawn's path attacked by the enemy?
                        if (b3 == EmptyBoardBB)
                            // No enemy attacks, huge bonus!
                            ebonus += Value(tr * (b2 == b4 ? 17 : 15));
                        else
						      {
                            // OK, there are enemy attacks. Are those squares which are
                            // attacked by the enemy also attacked by us?  If yes, big bonus
                            // (but smaller than when there are no enemy attacks), if no,
                            // somewhat smaller bonus.
New part:

Code: Select all

                            bonuspoints = Value(tr * ((b3 & b4) == b3 ? 13 : 8));

						          // Subtract some points if our passed pawn can't immediately 
						          // advance and especially if it is also attacked.
						          bonuspoints -= Value(indirectBlock * tr * (passed_pawnAttacked ? 4 : 3));
							       ebonus += bonuspoints;
						    }
                    }
                    else
                    {

3r1k2/p5pp/n1NP1p2/1NbB1b2/5P2/1P6/5P1P/5RK1 b - -

Engine: Ancalagon 1.3 WS180 Build 99 [new] (Athlon 2009 MHz,256 MB)
by Romstad, Costalba, Kiiski, de Groot

2.00 0:00 -0.70 1...Rd7 2.Ra1 (936) 3

3.00 0:00 -0.52 1...Rd7 2.Ra1 Nb4 (16.206) 60

4.00 0:00 +0.07 1...Rd7 2.Re1 Bxd6 3.Nxd6 Rxd6 (67.103) 195

5.00 0:00 +0.01 1...Rd7 2.Rd1 Nb4 3.Nxb4 Bxb4 4.Nd4 (138.878) 329

6.00 0:00 -0.70 1...Rd7 2.Rc1 (242.772) 431

7.00 0:00 -0.80 1...Rd7 2.Rc1 Bxd6 3.Ncd4 Bc5 4.Be6 Bxd4
5.Bxd7 (364.608) 518

8.00 0:01 -0.92 1...Rd7 2.Rc1 Ke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cyclone but still significant improvement :D

Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Old testposition I posted revisited...

Post by mcostalba »

Eelco de Groot wrote: New part:

Code: Select all

                            bonuspoints = Value(tr * ((b3 & b4) == b3 ? 13 : 8));

						          // Subtract some points if our passed pawn can't immediately 
						          // advance and especially if it is also attacked.
						          bonuspoints -= Value(indirectBlock * tr * (passed_pawnAttacked ? 4 : 3));
							       ebonus += bonuspoints;
						    }
                    }
                    else
                    {
Hi Eelco,

this seems interesting.

As soon as we get rid of the possibe regression that is affecting CEGT results I would like, if you don't mind, to test your change with real games that currently are the only metrics that we use for Stockfish advances.

BTW a metric a bit broken :-( as it seems after the latest CEGT results. It seems I still need to improve my testing skills a lot....
User avatar
Eelco de Groot
Posts: 4669
Joined: Sun Mar 12, 2006 2:40 am
Full name:   Eelco de Groot

Re: Old testposition I posted revisited...

Post by Eelco de Groot »

mcostalba wrote:
Eelco de Groot wrote: New part:

Code: Select all

                            bonuspoints = Value(tr * ((b3 & b4) == b3 ? 13 : 8));

						          // Subtract some points if our passed pawn can't immediately 
						          // advance and especially if it is also attacked.
						          bonuspoints -= Value(indirectBlock * tr * (passed_pawnAttacked ? 4 : 3));
							       ebonus += bonuspoints;
						    }
                    }
                    else
                    {
Hi Eelco,

this seems interesting.

As soon as we get rid of the possibe regression that is affecting CEGT results I would like, if you don't mind, to test your change with real games that currently are the only metrics that we use for Stockfish advances.

BTW a metric a bit broken :-( as it seems after the latest CEGT results. It seems I still need to improve my testing skills a lot....
Hi Marco,

Sure, that would be great, if you could test some of those changes and actually use them for Stockfish! I do try to be a bit more disciplined with making new code, I can only make anything when I have a good example for a change, but still anything C or C++ or C# that is beyond standard Pascal or Algol which I learned in High school waaay back, in the time of the first Boris and Chess Challengers is still really too complicated for me. But hopefully I learn a bit, it's great to have Tord's code and now yours as a real live application where you can test everything and anything!

I just know though that some of the changes I made, in the beginning mostly, are hurting much more than helping elo, but I still feel it was and is a good way to learn to simply try something and not throw it out right away if it does not seem to work. My theory is that some ideas just need to grow and could only begin to constitute real chess knowledge when they are more refined over time.

So, in that context there are still some things from the old Ancalagon which I did not really want to throw out, because I still believe in them for the future. And still learning what they do because that is the only way I could hope to one day make a better version. The King Safety changes I made for instance in Glaurung when it was still in the beta and -ε stages can't be good because they could increase normal values to even 0x350/0x100 times the values you guys are using for the King Attacks. And Tord even pointed out, right away, when I dared to post about the silly code that it was hopelessly flawed, - Tord would never say such a thing though!- because it breaks the symmetry, things are computed differently for Black and White. Very dangerous! But stubbornly I refused to listen to throw it out or even try to measure how much it would hurt in games. I know it would!

Well, only the King Safety I copied from the old version into Stockfish, all the passed pawn code I made I left out so far because Tord made a much better version that actually works :)

I think you should not worry to much about those figures that seem to indicate regression in the scaling for Stockfish 1.3. I think it is just very hard to get good figures for this, and you would have to be very disciplined in making the testing conditions completely equal so all the opponents would have to be the same, tested on the same machines by the same testers, you would need an enormous amount of games and you would be comparing single threaded versions mainly with double threaded versions, double threaded with four threaded, which is a very different thing than comparing programs only in their own class, single threaded against single threaded elonumbers, double threaded elo against double threaded competitors, those differences will be much more reliable!

Moreover if the multi CPU code from Glaurung or older Stockfish is essentially unchanged, I just would assume you guys can't have broken it much... If it is really unchanged then you are testing for zero deltas comparing two threads minus one thread with two threads minus one thread elo in the CEGT lists, four threads elo minus two threads elo compared with four threads minus the two threads elo between the two versions. It is very hard to prove any changes you do find there from zero are not normal statistical fluctuations...


Regards,
Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Old testposition I posted revisited...

Post by mcostalba »

Eelco de Groot wrote: Hi Marco,

Sure, that would be great, if you could test some of those changes and actually use them for Stockfish! I do try to be a bit more disciplined with making new code, I can only make anything when I have a good example for a change, but still anything C or C++ or C# that is beyond standard Pascal or Algol which I learned in High school waaay back, in the time of the first Boris and Chess Challengers is still really too complicated for me.
Pascal is more then enough ;-)

I am confident in C / C++ but sometime I look at sources that are almost unreadable or very difficult to understund. This is not due to the language but to the programmer that wrote a mess.

So if you find some difficult parts, please, it would be very appreciated if you can point me out to them so that I can rewrite in a better and more clear way.
Eelco de Groot wrote: The King Safety changes I made for instance in Glaurung when it was still in the beta and -ε stages can't be good
King safety is difficult. In a comment Tord says

Code: Select all

// King safety.  This is quite complicated, and is almost certainly far
// from optimally tuned.
For sure is difficult, but I don't think is far from optimally tuned because all the trials that we made to improve it were failures !
Eelco de Groot wrote: I think you should not worry to much about those figures that seem to indicate regression in the scaling for Stockfish 1.3.
I believe a lot in CEGT results, admittely currently are still "in flux" because single CPU results are way better then SMP, and we didn't touch SMP code, but one possibility is that also single CPU results will lower and will align with SMP case.

In the release cycle that lead to 1.3 testing was at 80% made against previous version of Stockfish. We know testing with different engines is better, but if you don't have a cluster, and we don't have, it takes more then double the time only for testing against a SINGLE different engine becuase you need to test also the original version not only the new modified one to have a test base.

Consider that to test _any_ modification that yields to a functionality change we run _at least_ 1000 games against each opponent, very often with cascading time controls: firts at very fast games then we do a verification at slower time controls.

So already now testing takes more then 90% of development time. What we are learning from CEGT results is that we should go to 99% !!!

I am more and more convinced that a testing team is the difference between a wanna be engine and a winner. I don't know how a lone developer, like it seems the Naum author, can afford to tackle this all alone. Perhaps he as a cluster too ? ;-)
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Old testposition I posted revisited...

Post by mcostalba »

Eelco de Groot wrote:

Code: Select all

                    if ((b2 & pos.pieces_of_color(them)) == EmptyBoardBB)
                    {
                        // There are no enemy pieces in the pawn's path! Are any of the
                        // squares in the pawn's path attacked by the enemy?
                        if (b3 == EmptyBoardBB)
                            // No enemy attacks, huge bonus!
                            ebonus += Value(tr * (b2 == b4 ? 17 : 15));
                        else
						      {
                            // OK, there are enemy attacks. Are those squares which are
                            // attacked by the enemy also attacked by us?  If yes, big bonus
                            // (but smaller than when there are no enemy attacks), if no,
                            // somewhat smaller bonus.
New part:

Code: Select all

                            bonuspoints = Value(tr * ((b3 & b4) == b3 ? 13 : 8));

						          // Subtract some points if our passed pawn can't immediately 
						          // advance and especially if it is also attacked.
						          bonuspoints -= Value(indirectBlock * tr * (passed_pawnAttacked ? 4 : 3));
							       ebonus += bonuspoints;
						    }
                    }
                    else
                    {
Hi Eelco,

I am trying to implement your code but it is not clear where to attach the new part, as example bonuspoints is even not defined.

Could you please post _all_ the code chunk it mean all the outer if statment code.

Code: Select all

if (pos.square_is_empty(blockSq))
From the above until the end of the above 'if'.

Thanks
Marco
User avatar
Eelco de Groot
Posts: 4669
Joined: Sun Mar 12, 2006 2:40 am
Full name:   Eelco de Groot

Re: Old testposition I posted revisited...

Post by Eelco de Groot »

mcostalba wrote:
Eelco de Groot wrote:
Hi Eelco,

I am trying to implement your code but it is not clear where to attach the new part, as example bonuspoints is even not defined.

Could you please post _all_ the code chunk it mean all the outer if statment code.

Code: Select all

if (pos.square_is_empty(blockSq))
From the above until the end of the above 'if'.

Thanks
Marco
Hi Marco,

When you posted I thought that I just had discovered a fatal bug and that it was only in the Ancalagon code, but I was wrong; it was just that I had copied some move wrong from the PV and let it analyze that. But it still means that I am not very satisfied with any of the changes and can't give a positive verdict on any of them yet. Well you know about the King Safety changes, those are just an ongoing experiment. Maybe it would be better if I just mailed you some of the changes because the forum copies the code here with tabstops it seems that I do not see in the MSVC compiler, so every time I have to try to correct the code, it is never quite right. It looks alright in the Visual C++ editor but not when I put it in between <code></code> here.

I don't have any CVS repository system, I'm just editing the files by hand and trying to save every old file with the last build that used this file as a tag in its name. As long as I don't forget to save the old versions I can reconstruct any build, but sometimes you want to do things too fast and you mess things up. As you mentally have to try to keep track of your changes anyway the system is not too bad but not well designed to be used by others.

So keep in mind I don't feel very confident that any change is working like I would like yet!

For now though the complete evaluate.cpp as used in my Build 110, Because I think that would be easier to copy into a file for comparison of the changes. I first viewed it in Wordpad and then copied that here, it seems to look a bit better now in preview mode, without the invisble tabstops so far :) :

Code: Select all


  // evaluate_passed_pawns() evaluates the passed pawns for both sides.

  void evaluate_passed_pawns(const Position &pos, EvalInfo &ei) {

    bool hasUnstoppable[2] = {false, false};
    int movesToGo[2] = {100, 100};

    for (Color us = WHITE; us <= BLACK; us++)
    {
        Color them = opposite_color(us);
        Square ourKingSq = pos.king_square(us);
        Square theirKingSq = pos.king_square(them);
        Bitboard b = ei.pi->passed_pawns() & pos.pawns(us), b2, b3, b4;

        while (b)
        {
            Square s = pop_1st_bit(&b);

            assert(pos.piece_on(s) == piece_of_color_and_type(us, PAWN));
            assert(pos.pawn_is_passed(us, s));

            int r = int(relative_rank(us, s) - RANK_2);
            int tr = Max(0, r * (r - 1));
            Square blockSq = s + pawn_push(us);
			bool indirectBlock = pos.see(s, blockSq) < 0;
			bool passed_pawnAttacked = bit_is_set(ei.attacked_by(them),s);

            // Base bonus based on rank
            Value mbonus = Value(20 * tr);
            Value ebonus = Value(10 + r * r * 10);

            // Adjust bonus based on king proximity
            if (tr != 0)
            {
                ebonus -= Value(square_distance(ourKingSq, blockSq) * 3 * tr);
                ebonus -= Value(square_distance(ourKingSq, blockSq + pawn_push(us)) * 1 * tr);
                ebonus += Value(square_distance(theirKingSq, blockSq) * 6 * tr);

                // If the pawn is free to advance, increase bonus
                if (pos.square_is_empty(blockSq))
                {
					Value bonuspoints;

                    b2 = squares_in_front_of(us, s);
                    b3 = b2 & ei.attacked_by(them);
                    b4 = b2 & ei.attacked_by(us);

                    // If there is an enemy rook or queen attacking the pawn from behind,
                    // add all X-ray attacks by the rook or queen.
                    if (    bit_is_set(ei.attacked_by(them,ROOK) | ei.attacked_by(them,QUEEN),s)
                        && (squares_behind(us, s) & pos.rooks_and_queens(them)))
                        b3 = b2;

                    if ((b2 & pos.pieces_of_color(them)) == EmptyBoardBB)
                    {
                        // There are no enemy pieces in the pawn's path! Are any of the
                        // squares in the pawn's path attacked by the enemy?
                        if (b3 == EmptyBoardBB)
						{
                            // No enemy attacks, huge bonus!
                            bonuspoints = Value(tr * (b2 == b4 ? 17 : 15));
						 
						    // Subtract some points if our passed pawn can't immediately 
						    // advance and especially if it is also attacked
						    bonuspoints -= Value(indirectBlock * tr * (passed_pawnAttacked ? 5 : 4));
                            ebonus += bonuspoints;
						}
                        else
						{
                            // OK, there are enemy attacks. Are those squares which are
                            // attacked by the enemy also attacked by us?  If yes, big bonus
                            // (but smaller than when there are no enemy attacks), if no,
                            // somewhat smaller bonus.
                            bonuspoints = Value(tr * ((b3 & b4) == b3 ? 13 : 8));

						    // Subtract some points if our passed pawn can't immediately 
						    // advance and especially if it is also attacked
						    bonuspoints -= Value(indirectBlock * tr * (passed_pawnAttacked ? 4 : 3));
							ebonus += bonuspoints;
						}
                    }
                    else
                    {
                        // There are some enemy pieces in the pawn's path. While this is
                        // sad, we still assign a moderate bonus if all squares in the path
                        // which are either occupied by or attacked by enemy pieces are
                        // also attacked by us.
                        bonuspoints = Value((((b3 | (b2 & pos.pieces_of_color(them))) & ~b4) == EmptyBoardBB) * tr * 6);

						// Subtract some points if our passed pawn can't immediately 
						// advance and especially if it is also attacked
						bonuspoints -= Value(indirectBlock * tr * (passed_pawnAttacked ? 3 : 2));
                        ebonus += bonuspoints;
                    }
                    // At last, add a small bonus when there are no *friendly* pieces
                    // in the pawn's path.
                    if ((b2 & pos.pieces_of_color(us)) == EmptyBoardBB)
                        ebonus += Value(tr);
                }
            }

            // If the pawn is supported by a friendly pawn, increase bonus
            b2 = pos.pawns(us) & neighboring_files_bb(s);
            if (b2 & rank_bb(s))
                ebonus += Value(r * 20);
            else if (pos.pawn_attacks(them, s) & b2)
                ebonus += Value(r * 12);

            // If the other side has only a king, check whether the pawn is
            // unstoppable
            if (pos.non_pawn_material(them) == Value(0))
            {
                Square qsq;
                int d;

                qsq = relative_square(us, make_square(square_file(s), RANK_8));
                d =  square_distance(s, qsq)
                   - square_distance(theirKingSq, qsq)
                   + (us != pos.side_to_move());

                if (d < 0)
                {
                    int mtg = RANK_8 - relative_rank(us, s);
                    int blockerCount = count_1s_max_15(squares_in_front_of(us,s) & pos.occupied_squares());
                    mtg += blockerCount;
                    d += blockerCount;
                    if (d < 0)
                    {
                        hasUnstoppable[us] = true;
                        movesToGo[us] = Min(movesToGo[us], mtg);
                    }
                }
            }
            // Rook pawns are a special case:  They are sometimes worse, and
            // sometimes better than other passed pawns. It is difficult to find
            // good rules for determining whether they are good or bad. For now,
            // we try the following: Increase the value for rook pawns if the
            // other side has no pieces apart from a knight, and decrease the
            // value if the other side has a rook or queen.
            if (square_file(s) == FILE_A || square_file(s) == FILE_H)
            {
                if(   pos.non_pawn_material(them) <= KnightValueMidgame
                   && pos.piece_count(them, KNIGHT) <= 1)
                    ebonus += ebonus / 4;
                else if(pos.rooks_and_queens(them))
                    ebonus -= ebonus / 4;
            }

            // Add the scores for this pawn to the middle game and endgame eval.
            ei.mgValue += apply_weight(Sign[us] * mbonus, WeightPassedPawnsMidgame);
            ei.egValue += apply_weight(Sign[us] * ebonus, WeightPassedPawnsEndgame);
        }
    }

    // Does either side have an unstoppable passed pawn?
    if (hasUnstoppable[WHITE] && !hasUnstoppable[BLACK])
       ei.egValue += UnstoppablePawnValue - Value(0x40 * movesToGo[WHITE]);
    else if (hasUnstoppable[BLACK] && !hasUnstoppable[WHITE])
       ei.egValue -= UnstoppablePawnValue - Value(0x40 * movesToGo[BLACK]);
    else if (hasUnstoppable[BLACK] && hasUnstoppable[WHITE])
    {
        // Both sides have unstoppable pawns! Try to find out who queens
        // first. We begin by transforming 'movesToGo' to the number of
        // plies until the pawn queens for both sides.
        movesToGo[WHITE] *= 2;
        movesToGo[BLACK] *= 2;
        movesToGo[pos.side_to_move()]--;

        // If one side queens at least three plies before the other, that
        // side wins.
        if (movesToGo[WHITE] <= movesToGo[BLACK] - 3)
            ei.egValue += UnstoppablePawnValue - Value(0x40 * (movesToGo[WHITE]/2));
        else if(movesToGo[BLACK] <= movesToGo[WHITE] - 3)
            ei.egValue -= UnstoppablePawnValue - Value(0x40 * (movesToGo[BLACK]/2));

        // We could also add some rules about the situation when one side
        // queens exactly one ply before the other: Does the first queen
        // check the opponent's king, or attack the opponent's queening square?
        // This is slightly tricky to get right, because it is possible that
        // the opponent's king has moved somewhere before the first pawn queens.
    }
  }
Complete evaluate.cpp did not fit so just the passed pawns routine 8-)

Regards, Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Old testposition I posted revisited...

Post by mcostalba »

Eelco de Groot wrote:
Complete evaluate.cpp did not fit so just the passed pawns routine 8-)
Hi Eelco,

thanks a lot !

In the mean time I have written something myself that I am testing now, it is along your ideas but code is a bit different. If tests are good I will post the code.

In case you are interested I suggest to use a CVS system. I use git, it is very powerful but not difficult to use and it comes very handy when you makes a lot of changes and you want to keep track of each of them.

Also exchanging patches it comes much easier.

Thanks
Marco