Author: Matthias Gemuh
Date: 08:25:56 09/03/03
Go up one level in this thread
On September 03, 2003 at 03:26:59, Uri Blass wrote:
>It is something that I need to fix but before fixing it I prefer
>to read what other people do.
>
>Today I update
>1)the side to move
>2)the ep array(I have instead of one global varaible an array of 3 numbers that
>gives me the en passant possibilities(square of the pawn that can capture and
>squares that it can capture) and maybe it is better if I compress it to one
>varaible and replace ep[0],ep[1],ep[2] by defines)
>
>I am also not sure if all my global varaibles is a good idea and it may be
>better to save the ep information only in the history information.
>
>3)A global varaible that is the zobrist key(maybe I should get rid of it and
>read the zobrist key from the history information something that is possible
>only after I change my makenull move)
>
>4)The arrays that are search dependent(for example the array that gives me
>information about the evaluation of every ply).
>
>I do not include these arrays in a struct and maybe I should do it.
>
>I do not update
>1)The fifty global varaible that tells me the number of plies
>from the last conversion and I am not sure how to update it after null move and
>if to reset it to 0 or to increase fifty by 1.
>
>2)The history ply and all the arrays in the struct that are dependent on it.
>
>3)The zobrist array that is history dependent and is used only for checking
>repetition.
>
>I already posted about this subject in another discussion
>(see http://www.talkchess.com/forums/1/message.html?313805)
>
>After getting no reply I decided that it may be better if I open a new
>discussion because the original name of the subject about bitboard is
>irrelevant.
>
>Uri
Hi Uri,
I cannot advise you because my engine is very weak,
but here is what I do:
void MakeNullMove(CHESSSTRUCT *ChsStrct, int nSideToMove)
{
ChsStrct->GameData[ChsStrct->PlyPtr].ep = ChsStrct->ChsPos.ep;
ChsStrct->GameData[ChsStrct->PlyPtr].CastleRights =
ChsStrct->ChsPos.CastleRights;
ChsStrct->ChsPos.ep = 0; ChsStrct->GameData[ChsStrct->PlyPtr].nRule50 =
ChsStrct->nRule50;
ChsStrct->ChsPos.SideToMove = ChangeSide(nSideToMove);
ChsStrct->GameData[ChsStrct->PlyPtr].HashKey = ChsStrct->ChsPos.HashKey;
ChsStrct->nRule50++; ChsStrct->PlyPtr++;
ChsStrct->GameData[ChsStrct->PlyPtr].HashKey = ChsStrct->ChsPos.HashKey;
UpdateHashKey2(HashTable, ChsStrct, ChsStrct->ChsPos.SideToMove);
ChsStrct->GameData[ChsStrct->PlyPtr].ep = ChsStrct->ChsPos.ep;
}
void UnmakeNullMove(CHESSSTRUCT *ChsStrct, int nSideToMove)
{
ChsStrct->PlyPtr--;
ChsStrct->ChsPos.ep = ChsStrct->GameData[ChsStrct->PlyPtr].ep;
ChsStrct->ChsPos.CastleRights =
ChsStrct->GameData[ChsStrct->PlyPtr].CastleRights;
ChsStrct->nRule50 = ChsStrct->GameData[ChsStrct->PlyPtr].nRule50;
ChsStrct->ChsPos.SideToMove = nSideToMove;
ChsStrct->ChsPos.HashKey = ChsStrct->GameData[ChsStrct->PlyPtr].HashKey;
UpdateHashKey2(HashTable, ChsStrct, ChsStrct->ChsPos.SideToMove);
}
UpdateHashKey2() updates only the parts of key that have to do with
castle rights, ep and SideToMove.
/Matthias.
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.