Poor Man Table Base

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: Poor Man Table Base

Post by sje »

Rebel wrote:
sje wrote:
Rebel wrote:
sje wrote:While you will have a very quick switch dispatch, you will pay a high price on the category assignment:

Code: Select all

category = end_class [wp][bp] [wn][bn] [wb][bb] [wr][br] [wq][bq];
That will generate a lot of multiply, shift, and add instructions.
I checked the ASM output, it's not so bad. I did not notice a drop in NPS also.
Perhaps, but what happens if one side has two queens? Your code will have to check the validity of EIGHT (w/b * q/r/b/n) bounds for safety before fetching from the table.
Yep, but 2 queens, 3 rooks, 4 knights etc. simply falls outside the scope of a simple poor man table base concept.

Besides, I use the system as a material imbalance table as well, in EVAL I add a pre-calculated bonus to score via a second table lookup.

Code: Select all

score+= material_bonus [wp][bp] [wn][bn] [wb][bb] [wr][br] [wq][bq];
Yes, but that material bonus lookup can be handled with the same binary ordered table probe. Just add a score component to the ordered table record holding the material signature key. If an increase in the entry count would make the ordered table too large, then use a hash based on the material signature key as did Chess4.x.
User avatar
hgm
Posts: 27860
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Poor Man Table Base

Post by hgm »

In Spartacus the default hamdling of the 1-byte entries of the material table is ss an additive score correction. Some 36 codes are set apart to signal special treatment is required, e.g. multiplicative discounting a la Fruit, or a recognizer. I use a material index from which the nr of pawns is easily recognized (the lowest 7 bits), and where the bishops have different weight, so I can list end-games with unlike B separately.