Pawn Shelter

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
outAtime
Posts: 226
Joined: Sun Mar 08, 2009 2:08 pm
Location: Canada

Pawn Shelter

Post by outAtime » Fri May 27, 2011 10:57 pm

Image

Black has advantage in this position however I'm getting the wrong score in this position because (I'm guessing) there is too much of a penalty for the lack of pawn shelter in black's kingside. Should there be 3 cases for calculating pawn shelter? e.g. castled same side, castled opposite, and one or both sides not castled? I'm not sure if all programs make this distinction, but something is wrong because as I increase the pawnshelter penalties whites score increases to + when it should really be a big -. It seems logical that black should still have a penalty here.. but the score when compared to (I would say all) other programs is wrong. I was thinking maybe only do pawnshelter with queens still on? Thanks.
outAtime

User avatar
Eelco de Groot
Posts: 4279
Joined: Sun Mar 12, 2006 1:40 am
Location: Groningen

Re: Pawn Shelter

Post by Eelco de Groot » Fri May 27, 2011 11:34 pm

Black has an extra Bishop so I would think you should see that Black is ahead even if you calculate King Safety here. What do you see if you disable the king safety calculation? The position I would say is more an endgame. White has only two Rooks left so right now I think there is not much chance of attacking the black king with that. It could change if White had a very progressed passed pawn. If there was a promotion somehow then sudenly this endgame could change into a middlegame again :o In Stockfish if White had a full Queen and at least a Rook, in Rainbow Serpent at least the equivalent of Rook and Queen then it would start calculating King Safety again. But even with king safety enabled you should see that Black has an extra piece here so the position is comfortable for Black?

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

outAtime
Posts: 226
Joined: Sun Mar 08, 2009 2:08 pm
Location: Canada

Re: Pawn Shelter

Post by outAtime » Sat May 28, 2011 12:15 am

well first of all the ksafety is set rather high to obtain a + score for white, secondly Im considering changing to a 100 400 600 1200 piece value since the old 100 (or 80, 90) 325 500 975 just doesn't seem to cut it unless I add some bad trade code... perhaps another question for a different thread, but I was wondering how programs using the 325etc. piece values get correct scores without using bad trade code... or do they all? I thought crafty removed it i could be wrong. BTW I added that there needs to be a queen on the board for shelter eval and that basically seems to solve alot of problems, maybe I will make it Q+R or equivalent as you suggested? Maybe having Q+R or equivalent is good measure of endgame too? I'm currently doing end_eval if pieces < 5 but I wonder if there cant be a better criteria esp. if ksafety needs queens off. Thanks again for your answer.
outAtime

outAtime
Posts: 226
Joined: Sun Mar 08, 2009 2:08 pm
Location: Canada

Re: Pawn Shelter

Post by outAtime » Sat May 28, 2011 12:24 am

By the way: With pawn shelter disabled score is about -1.60. I think that score is still not low enough but maybe thats because of the piece values.
outAtime

outAtime
Posts: 226
Joined: Sun Mar 08, 2009 2:08 pm
Location: Canada

Re: Pawn Shelter

Post by outAtime » Sat May 28, 2011 12:29 am

Stockfish (163) puts it at a whopping -3.00 while Rybka 3 puts it at around -1.50 so who knows :)
outAtime

Ferdy
Posts: 4581
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

Re: Pawn Shelter

Post by Ferdy » Sat May 28, 2011 1:28 am

outAtime wrote:Image

Black has advantage in this position however I'm getting the wrong score in this position because (I'm guessing) there is too much of a penalty for the lack of pawn shelter in black's kingside. Should there be 3 cases for calculating pawn shelter? e.g. castled same side, castled opposite, and one or both sides not castled? I'm not sure if all programs make this distinction, but something is wrong because as I increase the pawnshelter penalties whites score increases to + when it should really be a big -. It seems logical that black should still have a penalty here.. but the score when compared to (I would say all) other programs is wrong. I was thinking maybe only do pawnshelter with queens still on? Thanks.
Are you evaluating this position directly by calling your evaluation function or get the score by searching to a certain time or depth?

outAtime
Posts: 226
Joined: Sun Mar 08, 2009 2:08 pm
Location: Canada

Re: Pawn Shelter

Post by outAtime » Sat May 28, 2011 2:19 am

Im not sure I understand the question... a score is returned by the engine when I tell it to analyze.
outAtime

Ferdy
Posts: 4581
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

Re: Pawn Shelter

Post by Ferdy » Sat May 28, 2011 4:52 am

outAtime wrote:Im not sure I understand the question... a score is returned by the engine when I tell it to analyze.
[d]5r1k/1b5r/1pp3R1/3p4/p2Pp3/2P1P3/PP3PR1/3K4 w - - 9 1
In this position, Deuterium's eval without searching is -170. Searching it to 10 seconds is -243.

That means black is better by more than 1 pawn (1.70) without searching and black is better by more than 2 pawns (2.43) with a search to 10 seconds.

Code: Select all

# Deuterium v11.01.28.159
# Compiled&#58; Apr  6 2011

# Reading initialization file...
# Hash                     &#58; 24 Mb
# Eval Cache               &#58; 16 Mb
# Pawn Hash                &#58; 4 Mb
# Resign                   &#58; OFF
# Resign Score             &#58; -1200
# Resign Score Count       &#58; 5
# Book                     &#58; OFF
# Big Book Move Min Count  &#58; 2
# Use Egbb                 &#58; OFF
# Auto save game           &#58; OFF
# Write Learned Opening    &#58; OFF
# Contempt Value           &#58; 0
# Kibitz                   &#58; 0
# Ponder                   &#58; ON
# Time Increment Factor    &#58; 1
# Closing initialization file...


new
setboard 5r1k/1b5r/1pp3R1/3p4/p2Pp3/2P1P3/PP3PR1/3K4 w - - 9 1
5r1k/1b5r/1pp3R1/3p4/p2Pp3/2P1P3/PP3PR1/3K4 w - - 9 1
d

8  . . . . . r . k
7  . b . . . . . r
6  . o o . . . R .
5  . . . o . . . .
4  o . . P o . . .
3  . . P . P . . .
2  P P . . . P R .
1  . . . K . . . .

   a b c d e f g h

eval
posEval = -170, sideToMove = white
st 10
# search time is 10 sec
play
# Opponent info&#58; Name&#58;
# Deuterium &#40;W&#41; is out of book at move no. 1.
# TimeLeft=0.00 ms.  MaxTime=10000.00 ms  AllocatedTime=10000.00 ms.
# ply score  time     nodes Pv line
# -----------------------------------
  1  -154      1         66 d1d2
  2  -166      1        264 d1c1 h7h3 &#40;1.0&#41;
  3  -146      1        959 d1d2 b6b5 d2c2 &#40;1.0&#41;
  4  -164      1       2512 d1c1 h7h3 c1d1 f8f7 &#40;1.0&#41;
  5  -163      1       3237 d1c1 h7h3 c1d1 f8f7 d1c1 &#40;1.0&#41;
  6  -170      1       7712 d1c1 h7h3 b2b3 a4a3 c3c4 h3h1 c1d2 &#40;1.0&#41;
  7  -169      3      12275 d1c1 h7h3 b2b3 a4a3 c3c4 d5c4 b3c4 h3h7 &#40;2.1&#41;
  8  -215     10      70128 d1d2 b7a6 g6c6 a6f1 g2g6 f8f2 d2c1 h7h3 g6h6 h8g7 h6
h3 f1h3 c6b6 &#40;3.5&#41;
  9  -249     26     177963 c3c4 b7a6 c4d5 c6d5 d1e1 h7h1 g2g1 h1g1 g6g1 h8h7 a2
a3 a6d3 g1g5 &#40;2.4&#41;
 10  -241     31     219598 c3c4 b7a6 c4d5 c6d5 d1e1 h7h1 g2g1 h1g1 g6g1 h8h7 g1
g5 a6c4 a2a3 b6b5 &#40;1.2&#41;
 11  -261     46     331165 c3c4 b7a6 c4d5 c6d5 d1e1 h7h1 g2g1 h1g1 g6g1 h8h7 g1
h1 h7g6 b2b3 a4b3 h1g1 g6h5 a2b3 &#40;1.5&#41;
 12  -247     59     433588 c3c4 b7a6 c4d5 c6d5 d1e1 h7h1 g2g1 h1g1 g6g1 h8h7 g1
h1 h7g6 h1g1 g6h5 g1h1 h5g4 h1g1 g4h4 g1h1 h4g5 h1g1 g5f5 &#40;1.3&#41;
 13  -239    110     799177 d1d2 b7a6 g6c6 h7h1 c3c4 a6c4 d2c3 c4f1 g2g6 f8f2 g6
h6 h1h6 c6h6 h8g8 h6b6 &#40;1.9&#41;
 14  -226    145    1073373 d1d2 b7a6 g6c6 h7h1 c3c4 a6c4 d2c3 b6b5 c3b4 c4f1 g2
g5 f8f2 g5d5 f2b2 b4a3 &#40;1.3&#41;
 15  -223    190    1445633 d1d2 b7a6 g6c6 h7h1 c3c4 a6c4 d2c3 b6b5 c3b4 c4f1 g2
g5 f8f2 g5d5 f2b2 b4a3 b2d2 d5d8 h8g7 d8d7 g7g8 &#40;1.3&#41;
 16  -233    305    2311536 d1d2 b7a6 g6c6 h7h1 c3c4 a6c4 d2c3 b6b5 c6c5 c4a2 c5
b5 a2c4 b5b7 c4a6 b7b6 f8c8 c3b4 c8c4 b4a3 &#40;1.6&#41;
 17  -228    385    2911007 d1d2 b7a6 g6c6 h7h1 c3c4 a6c4 d2c3 b6b5 c6c5 h1h4 b2
b3 a4b3 a2b3 b5b4 c3b4 f8b8 b4a5 b8b3 c5c7 b3b5 a5a6 h4h5 &#40;1.3&#41;
 18  -243    803    6097021 b2b3 a4b3 a2b3 b7a6 c3c4 d5c4 b3c4 a6c4 g6c6 h7h1 d1
d2 c4f1 g2g5 b6b5 d2c3 f8f2 c6c8 h8h7 g5g8 f1h3 g8h8 h7g6 c8g8 g6f6 c3b4 &#40;2.1&#41;
# Time used=10015.00 msec.,  Pos/sec=757K,  NullHits=78.74%&#40;121573&#41;, HashHits=11
.71%&#40;173600&#41;.
# Pawn Hash&#58; hits=98%&#40;4096789&#41;
# WPiece=1000, WPawns=600, BPiece=1325, BPawns=500.
# Chk=159468, Recap=14, PP27=2435, PEnd=7.
# BM=b2b3, MS=-243, Fifty=0, Hply=1, Egbb=0.

1. b2b3

User avatar
Eelco de Groot
Posts: 4279
Joined: Sun Mar 12, 2006 1:40 am
Location: Groningen

Re: Pawn Shelter

Post by Eelco de Groot » Sat May 28, 2011 8:05 am

outAtime wrote:By the way: With pawn shelter disabled score is about -1.60. I think that score is still not low enough but maybe thats because of the piece values.
Hi,

If your engine evaluates it from the point of view from White as -1.60 and Rybka as -1.50 then I think you have it about right :)
secondly Im considering changing to a 100 400 600 1200 piece value since the old 100 (or 80, 90) 325 500 975 just doesn't seem to cut it unless I add some bad trade code...
Getting the right piece values is another matter especially with unequal material on board, as you suggest. I don't think you can solve everything without some form of bad trade score or code that achieves something similar, and most programs know at least some basic rules. If you really want to avoid trade rules that go against the piece values you use I think there is no other way than having more values for different kind of material combinations. I don't think it is a problem if you first look at for instance what GM Larry Kaufman wrote here http://mywebpages.comcast.net/danheisma ... alance.htm for instance and then study how it is implemented in Stockfish, in material.cpp There is a lot more stuff in there (in material.cpp) but you just need to begin somewhere, and the article of Larry Kaufman is specifically mentioned in the Stockfish source code. The material.cpp code has been discussed in this forum too, I also made a few posts on Tord Romstad's material imbalance code so I'd be happy to discuss it some more.

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

outAtime
Posts: 226
Joined: Sun Mar 08, 2009 2:08 pm
Location: Canada

Re: Pawn Shelter

Post by outAtime » Sun May 29, 2011 11:15 am

Yes, thankyou for the reply. I will have a look at the material code you have suggested and see if I get any ideas. I'm convinced at this point that some imbalance code is definitely needed using the 325 values. I've been doing a ton of bugfixing and even with kingsafety improved I'm still getting bad scores because the darn thing is a piece down (maybe for 2 pawns, even) and over-values the position with an open opp. king + weak passer. Interesting so much compensation is needed for a piece when the tactics are becoming clear :) Thanks again!
outAtime

Post Reply