Thoughts on Crafty's Castling, and Hash Table Implications

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

GothicChessInventor

Thoughts on Crafty's Castling, and Hash Table Implications

Post by GothicChessInventor »

Dr. Hyatt,

I noticed that crafty has an "incentive" to castle early by having your castling bonus decay with increasing ply (after changing WhiteCastle or BlackCastle to -ply when you castle during the search.)

My question is:

Suppose crafty castles relatively early during a search, say at ply 5, that position is then put into the hash table. Then, hypothetically, black moves, unmoves, then moves back, and in some other branch of the tree, white castles at say ply 11, after making a move/unmove that creates the same position.

Technically, the position is identical, but the value retrieved from the hash table will reward it "too much" since the position was hashed with a greater castling bonus.

Is this correct?

If so, any way around this? Maybe "unfolding" the castling bonus since the depth is stored in the hash table, then recoding it and applying it to the position?

Or doesn't this matter?

My concern would be for the opposite scenario. A "deep castling" would have a diminished bonus, and if this is hashed, and early castling move would retrieve too small a value.

Seems unlikely, but in the vast infinity of what is searched, it will undoubtetly arise.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Thoughts on Crafty's Castling, and Hash Table Implicatio

Post by bob »

GothicChessInventor wrote:Dr. Hyatt,

I noticed that crafty has an "incentive" to castle early by having your castling bonus decay with increasing ply (after changing WhiteCastle or BlackCastle to -ply when you castle during the search.)

My question is:

Suppose crafty castles relatively early during a search, say at ply 5, that position is then put into the hash table. Then, hypothetically, black moves, unmoves, then moves back, and in some other branch of the tree, white castles at say ply 11, after making a move/unmove that creates the same position.

Technically, the position is identical, but the value retrieved from the hash table will reward it "too much" since the position was hashed with a greater castling bonus.

Is this correct?

If so, any way around this? Maybe "unfolding" the castling bonus since the depth is stored in the hash table, then recoding it and applying it to the position?

Or doesn't this matter?

My concern would be for the opposite scenario. A "deep castling" would have a diminished bonus, and if this is hashed, and early castling move would retrieve too small a value.

Seems unlikely, but in the vast infinity of what is searched, it will undoubtetly arise.
We haven't done that in a long time. It has a serious problem in that hashing breaks it since we don't hash the depth information to adjust the score... It was a stop-gap approach a year+ ago but has long since been removed...
GothicChessInventor

Re: Thoughts on Crafty's Castling, and Hash Table Implicatio

Post by GothicChessInventor »

bob wrote:We haven't done that in a long time. It has a serious problem in that hashing breaks it since we don't hash the depth information to adjust the score... It was a stop-gap approach a year+ ago but has long since been removed...
I am just getting around to seeing some of the ill effects of it on the 80-square board and I'm looking for a suitable replacement before the 2007 Gothic Chess Computer Championship begins.

Thanks for your comments on this.