Author: Frank Phillips
Date: 04:32:28 05/09/99
Go up one level in this thread
On May 09, 1999 at 06:50:17, Andrew Williams wrote: >On May 09, 1999 at 06:31:41, Frank Phillips wrote: > >>I have noticed that bugs in my program sometimes cause the onset of >>irrationality where I bang the keyboard randomly hoping that by magic (or >>perhaps the monkeys writing Shakespeare theory) the problem will go away. >> >>Up until now I have been calculating the hash code for a position in the >>ABSearch() from scratch by looping through the board and XORing the Random64 >>[colour_of_piece][piece][square] combinations, followed by XORing for the >>enpassant square and castling rights. To speed things up I thought I would do >>this incrementally in the MakeMove() function by taking the last hash code >>(always stored as wtm), undoing the enpassant and castling effects, by XORing >>with same values to switch them off, then XORing to remove the piece from a >>square, put piece on square, remove captured piece, add promoted piece >>etc???.and then finally XORing the result for new enpassant square and castling >>rights. >> >>Everything works fine without hashing the enpassant square and castling rights, >>but not otherwise. By which I mean the new method gives the same hash code as >>that calculated from scratch in the same position by looping through the board, >>provided I do not hash for ep and castling. When I print out the moves, the >>offending move where it all goes wrong seems to be castling, but I cannot find >>the error. >> >>Should what I am doing work, so that there is still a bug in the incremental >>hash update I have not found yet, or can I not do it the way I am trying? > >What you describe here is exactly what I do, so it is possible to do it this >way. Do you also include the hashkey update for the Rook and King moving about >during castling? This question isn't meant to insult your intelligence; this >was one of the main problems I had when implementing incremental hashkey >updates. > >Andrew Thanks. Yes. I XOR king[E1]/king[G1]/rook[H1]/rook[F1] for example.
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.