What is the real coding difference Between pawn hash table and normal transposition tables?
I mean, how do you strip the position so there is only pawns, evaluate, them, and then save them ?
Edit: What is the expected gain from pawn hash tables when you already have tt???
pawn hash table difference
Moderators: hgm, Rebel, chrisw
-
- Posts: 134
- Joined: Mon May 16, 2011 6:58 pm
- Location: Denmark
-
- Posts: 670
- Joined: Mon Dec 03, 2007 3:01 pm
- Location: Barcelona, Spain
Re: pawn hash table difference
It very much depends on the complexity of your pawn evaluation. The more complex your pawn evaluation the higher the gain with a pawn tt. The advantage of it being that pawn structure doesn't change so much and thus not many entries are needed and you will still get hit-rates of > 99%.
Usually a separate hash key is kept that gets only updated on pawn moves. A variation to this also hashes the king position and thus adds pawn shelter evaluation into the pawn tt value.
Usually a separate hash key is kept that gets only updated on pawn moves. A variation to this also hashes the king position and thus adds pawn shelter evaluation into the pawn tt value.
-
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: pawn hash table difference
And moves capturing pawns.Edmund wrote:Usually a separate hash key is kept that gets only updated on pawn moves.
Sven
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: pawn hash table difference
Expected gain: Your pawn scoring is free. You will see 99%+ pawn hash hits, which means whatever code you stick in there is free and doesn't cost you any additional time.ethanara wrote:What is the real coding difference Between pawn hash table and normal transposition tables?
I mean, how do you strip the position so there is only pawns, evaluate, them, and then save them ?
Edit: What is the expected gain from pawn hash tables when you already have tt???
Pawn hash has no piece information except for the king position. Therefore, pawn scoring can not include any piece information except for the king, or you will have some interesting bugs to deal with (been there, done that, got the T-shirt.) I have a separate passed pawn evaluation that is outside the hashing, because it needs to include pieces for blockading, preventing passed pawns from running, etc... so it is outside the code where the hash is checked or stored.
-
- Posts: 900
- Joined: Tue Apr 27, 2010 3:48 pm
Re: pawn hash table difference
The tt is a cache of search results, the pawn hash table is a cache of pawn eval results. So the pawn hash table is simpler in the sense that it doesn't need to deal with stuff like node types, depths etc.
-
- Posts: 180
- Joined: Mon Sep 03, 2007 9:15 am
Re: pawn hash table difference
A hash code for the pawn positions and a score are mandatory for a pawn hash table. But you can put much more information into it that is expensive to calculate and that is useful in other parts of the evaluation. For exapmle passers, backward pawns and open files.
-
- Posts: 134
- Joined: Mon May 16, 2011 6:58 pm
- Location: Denmark
Re: pawn hash table difference
Cant you also make a hash table for rooks? There can only be about 15 million different positions with four rooks, and you could add info such as rook on 7th .
Has anyone tried that?
Has anyone tried that?
-
- Posts: 3232
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: pawn hash table difference
a pawn hash table is just a normal hash table, except that:ethanara wrote:What is the real coding difference Between pawn hash table and normal transposition tables?
I mean, how do you strip the position so there is only pawns, evaluate, them, and then save them ?
Edit: What is the expected gain from pawn hash tables when you already have tt???
it stores a zobrist key for pawns only (you can remove castling rights, turn of play, and pieces). therefore you'll have a lot of hash table "hits" because in the search the pawn structure takes mucyh less "possible forms" than the whole chess board
-
- Posts: 27814
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: pawn hash table difference
The Rook-on-7th info does not depend on the pair of Rooks.You can simply put it in the piece-square tables. But for most advanced engines the bonus depends on the presence of Pawns on that same Rank, or of a King on the 8th. You could not see that from Rook positons only. In fact, the position of one Rook has very little effect on what is a good square for the other. Connecting the Rooks could get a bonus, but it is quite cheap to test 'on the fly', and thus not worth tabulating (plus that it also does not depend on Rook locations only, but on intervening pieces of any type as well).
For Pawns this is all completely different. How good a Pawn is on a certain square depends almost exclusively on where other Pawns are. A white Pawn on c4 could be a winning advantage (e.g. protected passer) or a lethal weakness (e.g. isolated doubled pawn).
For Pawns this is all completely different. How good a Pawn is on a certain square depends almost exclusively on where other Pawns are. A white Pawn on c4 could be a winning advantage (e.g. protected passer) or a lethal weakness (e.g. isolated doubled pawn).
-
- Posts: 900
- Joined: Tue Apr 27, 2010 3:48 pm
Re: pawn hash table difference
The rook eval is probably too lightweight to get accelerated by a hash table. Accessing a big hash table almost always means loading a value from memory, which takes much longer than a few ALU operations.ethanara wrote:Cant you also make a hash table for rooks? There can only be about 15 million different positions with four rooks, and you could add info such as rook on 7th .
Has anyone tried that?
If you have a complex enough rook eval, it could be worth it I guess.