Endgame Evaluation help!

Discussion of chess software programming and technical issues.

Moderator: Ras

Edsel Apostol
Posts: 803
Joined: Mon Jul 17, 2006 5:53 am
Full name: Edsel Apostol

Re: Endgame Evaluation help!

Post by Edsel Apostol »

Hi Sam,

How's Learning Lemming? I have not yet implemented SMP in my engine so I have not contacted you yet about your proposal before on the SMP collaboration.

Maybe you could try also to recruit Zach. He is good in SMP stuff.
User avatar
Kempelen
Posts: 620
Joined: Fri Feb 08, 2008 10:44 am
Location: Madrid - Spain

Re: Endgame Evaluation help!

Post by Kempelen »

I copy a profile test from 10 position to sd 6.

With this test, I get around 500.000 nps. I cann't optimize more, or maybe optimize for around 100.000 nps more. I think my main problem is the way I use bitboards (calculate all attacks and moves by getFirstbit and getLastbit), the primitive way without rotated or magic.

do you think I would have more nps with the way I use bitboard???

anyway I plan to migrate to rotated or magic in a next version

thx

Code: Select all

+------------+--------------+-------+------------------------------------+
| Calls (xK) | Total Ms.    |   %   | Tag                                |
+------------+--------------+-------+------------------------------------+
| 0000000439 | 000000007187 | 11.4% | busqueda()                         |
| 0000000841 | 000000006125 |  9.7% | calcularAtaquesYMovilidad()        |
| 0000001735 | 000000006095 |  9.6% | quiesce()                          |
| 0000014572 | 000000005895 |  9.3% | movilidadPieza()                   |
| 0000002654 | 000000004101 |  6.5% | hacerMovimiento()                  |
| 0000000349 | 000000002968 |  4.7% | evaluarMedioJuego()                |
| 0000002941 | 000000002871 |  4.5% | ordenarMovimiento()                |
| 0000000349 | 000000002225 |  3.5% | examinarColumnas()                 |
| 0000000000 | 000000001938 |  3.1% | hashReset()                        |
| 0000001709 | 000000001936 |  3.1% | evaluar()                          |
| 0000003828 | 000000001692 |  2.7% | filaPeonBlanco()                   |
| 0000000491 | 000000001655 |  2.6% | evaluarFinal()                     |
| 0000004664 | 000000001632 |  2.6% | estaAtacada()                      |
| 0000002895 | 000000001520 |  2.4% | deshacerMovimiento()               |
| 0000003745 | 000000001405 |  2.2% | filaPeonNegro()                    |
| 0000003418 | 000000001363 |  2.2% | evaluarVentajaMaterial()           |
| 0000002241 | 000000001341 |  2.1% | piezaClava()                       |
| 0000001497 | 000000001295 |  2.0% | SEE()                              |
| 0000001417 | 000000001065 |  1.7% | bRepeticion()                      |
| 0000001217 | 000000000973 |  1.5% | situacionPiezas()                  |
| 0000001417 | 000000000904 |  1.4% | esTablas()                         |
| 0000001130 | 000000000779 |  1.2% | reducciones()                      |
| 0000001063 | 000000000762 |  1.2% | SEE_SQ()                           |
| 0000001980 | 000000000731 |  1.2% | actualizarHash()                   |
| 0000001372 | 000000000673 |  1.1% | extensiones()                      |
| 0000000559 | 000000000612 |  1.0% | generarCapturas()                  |
| 0000000276 | 000000000546 |  0.9% | generarMovimientos()               |
| 0000000349 | 000000000533 |  0.8% | escudoPeonesBlancos()              |
| 0000000349 | 000000000474 |  0.7% | escudoPeonesNegros()               |
| 0000000763 | 000000000437 |  0.7% | fasePartida()                      |
| 0000000419 | 000000000312 |  0.5% | guardarHash()                      |
| 0000000462 | 000000000296 |  0.5% | probarHash()                       |
| 0000000041 | 000000000218 |  0.3% | quiesce_root()                     |
| 0000000000 | 000000000189 |  0.3% | mostrarVariantePrincipal()         |
| 0000000000 | 000000000155 |  0.2% | pensar()                           |
| 0000000241 | 000000000140 |  0.2% | hacerMovimientoNulo()              |
| 0000000244 | 000000000125 |  0.2% | R()                                |
| 0000000010 | 000000000076 |  0.1% | hacerPromocion()                   |
| 0000000000 | 000000000000 |  0.0% | calcularRestante()                 |
| 0000000000 | 000000000000 |  0.0% | inicializarKillers                 |
| 0000000000 | 000000000000 |  0.0% | obtenerHash()                      |
| 0000000000 | 000000000000 |  0.0% | evaluarApertura()                  |
| 0000000000 | 000000000000 |  0.0% | movimientosRaiz()                  |
| 0000000000 | 000000000000 |  0.0% | hash_vp()                          |
| 0000000001 | 000000000000 |  0.0% | strMovimientoSAN()                 |
| 0000000000 | 000000000000 |  0.0% | strVariantePrincipal()             |
| 0000000000 | 000000000000 |  0.0% | generarMovsLegales()               |
| 0000000002 | 000000000000 |  0.0% | hacerEnroque()                     |
| 0000000001 | 000000000000 |  0.0% | ordenarMovimientosRaiz()           |
| 0000000000 | 000000000000 |  0.0% | controlTiempo()                    |
| 0000000000 | 000000000000 |  0.0% | inicializarHash()                  |
| 0000000000 | 000000000000 |  0.0% | hacerAlPaso()                      |
+------------+--------------+-------+------------------------------------+
Dann Corbit
Posts: 12778
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Endgame Evaluation help!

Post by Dann Corbit »

Tord Romstad wrote:
bob wrote:
Tord Romstad wrote:
bob wrote:3. outside/distant passed pawns and the fact that they become more valuable as material is reduced.
Has anyone apart from Bob managed to make this work? I've tried outside passed pawn bonuses many times over the years, and the impact on playing strength has always been zero or negative. Scaling the bonus by remaining material does not seem to help.

I'll give it another try in the autumn, if I get enough time to start working on my chess engine again.

Tord
It's always worked for me. For a year it was a critical piece of evaluation that gave Crafty significant superiority over many chess programs. But slowly they all started doing it. I remember when Bruce added it to Ferret, and Dave added it to Wchess, etc...
That's strange -- I have the source code of all the current top open source programs, and several of the top private and commercial programs, and as far as I can recall, none of them has any bonus for outside passed pawns.

Nevertheless, I'll give it another try later this year, if I find some time. Thanks for reminding me. :)

Tord
If you look at the Amy source code, in score.c you will see references like this one:

Code: Select all

#ifdef DEBUG
            if(DebugWhat & DebugPassedPawns) {
                Print(0, "white outside passend pawn on %c%c\n", SQUARE(sq));
            }
#endif
Phalanx has it:

Code: Select all

CHESSD~1.15\ENGINES\PHALAN~1\ENDGAME.C  90              int Oppb[17] =  /* outside passed pawn bonus */
       /*       +10  +8  +6  +4             */
       {  0,  0, 40, 50, 58, 64, 68, 68,
       68, 68, 68, 68, 68, 68, 68, 68, 68 };
SCIDlet uses this table:

Code: Select all

int outside_passed[128] = {
 160, 100, 100, 100,  80,  80,  80,  70,
  60,  50,  40,  40,  30,  30,  20,  20,
  16,  16,  10,  10,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0,
   0,   0,   0,   0,   0,   0,   0,   0
};
Slowchess:

Code: Select all

SLOW296\ENDGAM~1.CPP    216                     // Outside passed pawns, etc.
ExChess:

Code: Select all

EXCHESS5\RELEAS~1\SRC\SCORE.CPP 290             | Outside passed pawns
Probably many others too.

Illustration of equal material but outside passed pawn wins:
[d]8/4kp2/6p1/7p/P7/2K3P1/7P/8 w - - id "Fischer-Larsen 1971"; c0 "Source: http://en.wikipedia.org/wiki/Passed_paw ... assed_pawn";

Rooks or queens neurtalize them:
[d]R7/6k1/P5p1/5p1p/5P1P/r5P1/5K2/8 w - - id "Levenfish and Smyslov, 1957"; c0 "Source: http://en.wikipedia.org/wiki/Passed_paw ... assed_pawn"; c1 "Outside passed pawn neutralized by minor rook";
User avatar
Zach Wegner
Posts: 1922
Joined: Thu Mar 09, 2006 12:51 am
Location: Earth

Re: Endgame Evaluation help!

Post by Zach Wegner »

Edsel Apostol wrote:Hi Sam,

How's Learning Lemming? I have not yet implemented SMP in my engine so I have not contacted you yet about your proposal before on the SMP collaboration.

Maybe you could try also to recruit Zach. He is good in SMP stuff.
Hmm... that might be possible.

...For a nominal fee, of course. :lol:

Seriously though, I would need to finish it in my engine first!
Dann Corbit
Posts: 12778
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Endgame Evaluation help!

Post by Dann Corbit »

Edsel Apostol wrote:I'm wondering about the definition of this "outside/distant passed pawns".

Is it similar to KingPasser or UnstoppablePasser from Fruit?
It's a combination of unstoppable passed pawn and king to pawn taxicab distance mainly, I think.

Here is an explanation:
http://en.wikipedia.org/wiki/Passed_paw ... assed_pawn

I think that there is an implicit definition, not spelled out in the explanation, that the opposing king won't be able to intercept it (or the act of interception will cause other serious problems {such as leaving other chessmen undefended} because he is far away).

I guess that if nothing is hanging and the opposing king can intercept, then it probably should not get a bonus (or the bonus should be reduced).
Edsel Apostol
Posts: 803
Joined: Mon Jul 17, 2006 5:53 am
Full name: Edsel Apostol

Re: Endgame Evaluation help!

Post by Edsel Apostol »

Thanks Dann.

I think I didn't have that one on my eval. My opinion is that it is hard to create an accurate score and code for that. And it seems to be redundant anyway as the passed pawn is already scored. Maybe the search would compensate for this knowledge, though I might be wrong.
Edsel Apostol
Posts: 803
Joined: Mon Jul 17, 2006 5:53 am
Full name: Edsel Apostol

Re: Endgame Evaluation help!

Post by Edsel Apostol »

I can't imagine anyone scoring distant/outside passers higher with more material on the board. With lots of pieces the pawn generally can't be advanced too far or it will be lost... while in a king and pawns only ending, it is almost a forced win...
I misunderstood it for other passed pawn feature. You are right. Though I'm not sure if scoring it statically would help, search might be the better one to score this.
Edsel Apostol
Posts: 803
Joined: Mon Jul 17, 2006 5:53 am
Full name: Edsel Apostol

Re: Endgame Evaluation help!

Post by Edsel Apostol »

I think you could make your engine faster by using other faster bitboard methods. There are a lot to chose from, Pradu's Magic Move Generation, Gerd's Kindergarten Method, Olithik's method, etc..

Take a look here. Its a repository of knowledge collected through the discussions on the forums. http://chessprogramming.wikispaces.com/Bitboards
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Endgame Evaluation help!

Post by bob »

Edsel Apostol wrote:
I can't imagine anyone scoring distant/outside passers higher with more material on the board. With lots of pieces the pawn generally can't be advanced too far or it will be lost... while in a king and pawns only ending, it is almost a forced win...
I misunderstood it for other passed pawn feature. You are right. Though I'm not sure if scoring it statically would help, search might be the better one to score this.
That is almost always the case, except for the minor detail that it makes the search an intractable computational problem. We try to reach positions that are quiescent so that we can evaluate them with little risk of missing a dynamic feature that renders the static eval incorrect. But this is an almost impossible goal and it is the primary source of errors in chess engines.
Dann Corbit
Posts: 12778
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Endgame Evaluation help!

Post by Dann Corbit »

Edsel Apostol wrote:Thanks Dann.

I think I didn't have that one on my eval. My opinion is that it is hard to create an accurate score and code for that. And it seems to be redundant anyway as the passed pawn is already scored. Maybe the search would compensate for this knowledge, though I might be wrong.
I think you are right and the term is probably only valuable for blitz games where the pawn race might not be resolved. I guess also that it is a fine art to get it right, since I can think of positions where the heuristic does not seem to work.