Author: Michel Langeveld
Date: 14:34:39 03/15/04
Go up one level in this thread
In my former message I used the word "release" but meant "realise".
It's a pity I can't edit messages here after sending since many times I see a
lot of spelling mistakes if I reread it after some minutes.
About the pawnhash .... it's already in the new Nullmover ... and gave me a 1%
performance increase :-)
I'm not sure if I understand your question but Nullmover has 3 gamefases:
* Opening
* Middlegame
* Endgame
For each fase different evaluation parts are done. For example there is for each
fase a different piece square atbel where pieces are the strongest.
The value for the king is as follows:
static const scoreType whiteKingOpening_ScoreInput[8][8] =
{
{-30,-30,-30,-30,-30,-30,-30,-30},
{-27,-27,-27,-27,-27,-27,-27,-27},
{-24,-24,-27,-30,-30,-27,-24,-24},
{-21,-21,-24,-27,-27,-24,-21,-21},
{-18,-18,-21,-24,-24,-21,-18,-18},
{-15,-15,-18,-21,-21,-18,-15,-15},
{-12,-12,-12,-12,-12,-12,-12,-12},
{ 8, 10, 8, -5, 0, -5, 10, 8}
};
static const scoreType whiteKingMiddleGame_ScoreInput[8][8] =
{
{-10,-10,-10,-10,-10,-10,-10,-10},
{ -9, -9, -9, -9, -9, -9, -9, -9},
{ -8, -8, -8, -8, -8, -8, -8, -8},
{ -7, -7, -7, -7, -7, -7, -7, -7},
{ -6, -6, -6, -6, -6, -6, -6, -6},
{ -5, -5, -5, -5, -5, -5, -5, -5},
{ -4, -4, -4, -4, -4, -4, -4, -4},
{ 8, 10, 2, -3, -5, -2, 10, 8}
};
static const scoreType whiteKingEndGame_ScoreInput[8][8] =
{
{-15,-10, -6, -2, -2, -6,-10,-15},
{-10, -3, 3, 5, 5, 3, -3,-10},
{ -6, 3, 7, 10, 10, 7, 3, -6},
{ -2, 5, 10, 20, 20, 10, 5, -2},
{ -2, 5, 10, 20, 20, 10, 5, -2},
{ -6, 3, 7, 10, 10, 7, 3, -6},
{-10, -3, 3, 5, 5, 3, -3,-10},
{-15,-10, -6, -2, -2 -6,-10,-15}
};
This fase is hashed in the pawnhashtable, as follows
int evalKingPawn()
{
pieceListType *pl;
fieldType f;
//get a pointer to the pawnhash
//p.dynPawnHash is updated incrementally
pPawnHashRecord = &pawnHashTable[p.dynPawnHash & pawnHashMask];
//is the key the same, and also the fase the same?
//Maybe I should hash the fase in the p.dynPawnHash
//Then I don't have to store it in the hash anymore
if (pPawnHashRecord->key == p.dynPawnHash &&
pPawnHashRecord->fase == p.fase)
{
pawnHashHitCounter++;
return pPawnHashRecord->score;
}
scoreType score = 0;
//reset the whole record
memset(pPawnHashRecord, 0, sizeof(pawnHashTableType));
...
...
//add score of white king
//p.fase is 0, 120 or 240.
//So in this way I shift quickly to the right piece square table without
//and ugly if
score += whiteKingScore[p.fase+p.whiteKingField];
//add score of black king
score -= blackKingScore[p.fase+p.blackKingField];
...
...
//white pawn
pl = &piecelist[WHITE][PAWN];
for (i=0; i<pl->number; i++)
{
f = pl->loc[i];
...
score += whitePawnScore[p.fase+f];
}
//black pawn
pl = &piecelist[BLACK][PAWN];
for (i=0; i<pl->number; i++)
{
f = pl->loc[i];
...
score -= blackPawnScore[p.fase+f];
}
..
..
pPawnHashRecord->fase = p.fase;
pPawnHashRecord->key = p.dynPawnHash;
pPawnHashRecord->score = score;
pawnHashRecordCounter++;
return score;
}
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.