Alternating Scores

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

evandam
Posts: 18
Joined: Mon Feb 07, 2011 9:12 pm

Alternating Scores

Post by evandam »

I have been writing a chess engine from total scratch. Just in my spare time. I have started with a mailbox array square-centric board representation. I began with a simple MiniMax search and have since implemented Alpha Beta and Negascout searches with move ordering that have improved the engine. I have many things on my to do list such as bit board and changing evaluations from middle to end game, hash tables etc.

My question is when I evaluate a position my evaluation varies from ply to ply pretty dramatically. For instance from this position I get.

FEN: 5rk1/pp4p1/2n1p2p/2Npq3/2p5/6P1/P3P1BP/R4Q1K w - - 0 1

1. +10.60
2. -6.90
3. +1.10
4. -5.40
5. +6.60
6 +4.10
7 +7.70

I understand why this happens, but I wonder how the mainstream engines seem to normalize the score from ply to ply.

Now granted my eval is pretty simple at this point. Maybe they are searching a bit deeper on primary variations and just reporting that. I'm just making sure I'm not missing something. Maybe the hash tables have a lot to do with this.

Take it easy on me. I'm a programmer for a living, but I'm a horrible chess player and this is my first post here.
Richard Allbert
Posts: 792
Joined: Wed Jul 19, 2006 9:58 am

Re: Alternating Scores

Post by Richard Allbert »

Do you have Quiescence Search implemented?

If not, have a look here :

http://chessprogramming.wikispaces.com/ ... nce+Search

If this isn't implemented, you'll have a bad horizon effect each ply you search, and this will will swing + / - depending on odd even plys (different side to move at the leaves) as the last move in the move chain will most likely be a capture "winning" material.

Regards

Richard
evandam
Posts: 18
Joined: Mon Feb 07, 2011 9:12 pm

Re: Alternating Scores

Post by evandam »

Wow that was quick. At a quick glance at that URL, that would be my problem. Its late, but i will add that to the top of my to do list.
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: Alternating Scores

Post by michiguel »

evandam wrote:I have been writing a chess engine from total scratch. Just in my spare time. I have started with a mailbox array square-centric board representation. I began with a simple MiniMax search and have since implemented Alpha Beta and Negascout searches with move ordering that have improved the engine. I have many things on my to do list such as bit board and changing evaluations from middle to end game, hash tables etc.

My question is when I evaluate a position my evaluation varies from ply to ply pretty dramatically. For instance from this position I get.

FEN: 5rk1/pp4p1/2n1p2p/2Npq3/2p5/6P1/P3P1BP/R4Q1K w - - 0 1

1. +10.60
2. -6.90
3. +1.10
4. -5.40
5. +6.60
6 +4.10
7 +7.70

I understand why this happens, but I wonder how the mainstream engines seem to normalize the score from ply to ply.

Now granted my eval is pretty simple at this point. Maybe they are searching a bit deeper on primary variations and just reporting that. I'm just making sure I'm not missing something. Maybe the hash tables have a lot to do with this.

Take it easy on me. I'm a programmer for a living, but I'm a horrible chess player and this is my first post here.
Hi Erick,

I am almost sure you do not have a quiescence search
http://chessprogramming.wikispaces.com/ ... nce+Search

This is critical.

BTW, disable or have a switch to disable hashtables at this point. They introduce a level of uncertainty (and source of bugs) that you do not need for now. At least, until you stabilize basic things like alpha-beta + quiescence and a basic move ordering. You can safely use hashtables to obtain a predicted best move, without using the score to cut off.

Start early producing tools to dump the whole tree, so you can examine what is going on in shallow searches.

Miguel
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Alternating Scores

Post by bob »

evandam wrote:I have been writing a chess engine from total scratch. Just in my spare time. I have started with a mailbox array square-centric board representation. I began with a simple MiniMax search and have since implemented Alpha Beta and Negascout searches with move ordering that have improved the engine. I have many things on my to do list such as bit board and changing evaluations from middle to end game, hash tables etc.

My question is when I evaluate a position my evaluation varies from ply to ply pretty dramatically. For instance from this position I get.

FEN: 5rk1/pp4p1/2n1p2p/2Npq3/2p5/6P1/P3P1BP/R4Q1K w - - 0 1

1. +10.60
2. -6.90
3. +1.10
4. -5.40
5. +6.60
6 +4.10
7 +7.70

I understand why this happens, but I wonder how the mainstream engines seem to normalize the score from ply to ply.

Now granted my eval is pretty simple at this point. Maybe they are searching a bit deeper on primary variations and just reporting that. I'm just making sure I'm not missing something. Maybe the hash tables have a lot to do with this.

Take it easy on me. I'm a programmer for a living, but I'm a horrible chess player and this is my first post here.
I do not follow your numbers. +10.x at the root is more than a queen up? Or is there some sort of multiplier used elsewhere so that those score changes are really tiny rather than being major material values???
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Alternating Scores

Post by hgm »

The scoring is indeed a bit weird. The position is

[d]5rk1/pp4p1/2n1p2p/2Npq3/2p5/6P1/P3P1BP/R4Q1K w - - 0 1

which is about equal (B vs 3P). So how can you be at +10 after 1 ply? You cannot grab a Queen in 1 ply...
User avatar
Desperado
Posts: 879
Joined: Mon Dec 15, 2008 11:45 am

Re: Alternating Scores

Post by Desperado »

looks like factor about 10 if material is 1,3,3,5,9. doesnt it ?
evandam
Posts: 18
Joined: Mon Feb 07, 2011 9:12 pm

Re: Alternating Scores

Post by evandam »

Yea I'm not quite sure what my multipliers are set to right now, but there is a material inbalance of 5 (using 1 3 5 9) piece values. I have not spent alot of time on the eval yet, so don't get to caught up in that. Right now I think it only does material, center control and a few other small things. The reason I'm not sure is this program was on the shelf for 8 months or so after my son was born and I'm just starting to work on it again.

Thanks for the responses.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Alternating Scores

Post by bob »

evandam wrote:Yea I'm not quite sure what my multipliers are set to right now, but there is a material inbalance of 5 (using 1 3 5 9) piece values. I have not spent alot of time on the eval yet, so don't get to caught up in that. Right now I think it only does material, center control and a few other small things. The reason I'm not sure is this program was on the shelf for 8 months or so after my son was born and I'm just starting to work on it again.

Thanks for the responses.
if it is doing material, the question has to be how are you losing that much material in just one ply?

Do you do any extensions? If so, you have to make sure that your evaluation always returns a consistent score. That is, +=good for side on move, -=bad for side to move. Otherwise each successive ply will see a huge swing if the eval is always +=good for white. And every other ply will produce the worst possible move, not the best, in addition...
evandam
Posts: 18
Joined: Mon Feb 07, 2011 9:12 pm

Re: Alternating Scores

Post by evandam »

Ok I looked at the eval a little closer. To simplify, I took out everything except the material evaluation. Turns out I have the piece values set at 1 3 3.1 7 10 (for P N B R Q). I also simplified this to 1 3 3 7 10. So again from.

5rk1/pp4p1/2n1p2p/2Npq3/2p5/6P1/P3P1BP/R4Q1K w - - 0 1

1 +7.00 Qxf8+
2 -3.00 Qxf8+ Kxf8
3 +1.00 Bf3 a5 Nxe6
4 -3.00 Nxb7 Rxf1+ Rxf1 Qxe2
5 +7.00 Qxf8+ Kxf8 Nd7+ Ke7 Nxe5

Initially both sides have 27. Qxf8+ and it is 27-20 (+7.00). Qxf8+ Kxf8 and it is 17-20 (-3.00) and so on.

If we can agree on that, and overlook the fact that maybe my piece values are bad etc. Quiescence sounds like the way to quite these swings.