Author: Russell Reagan
Date: 07:34:12 01/03/03
Go up one level in this thread
On January 03, 2003 at 04:29:10, Peter Fendrich wrote: >It's hard to see why you should get different results if it's not within >generateLeagalMoves(). One thought, is it possible that firstMove and/or >lastMove in some way are corrupted due to the recursion in perft? >I dont know what they stand for if they are "real" or maybe it's just >pseudocode... >Peter generateLegalMoves calls generateMoves (which generates pseudo-legal moves) and clears out the illegal moves, leaving only legal ones (I hope). int generateLegalMoves () { move_t moves[256]; int i = 0; generateMoves(); for (move_t * move = firstMove; move != lastMove; ++move) { makeMove(move); if (illegal()) { // side not to move in check undoMove(); continue; } undoMove(); moves[i++] = *move; } for (int n = 0; n < i; ++n) firstMove[n] = moves[n]; lastMove = firstMove + i; return i; } firstMove and lastMove are macros (kind of) #define firstMove (hist[ply].first) #define lastMove (hist[ply+1].first) I could post the whole thing, or upload it for download (if someone is really that interested in helping me out), but the code is largely uncommented and not exactly what I've seen in most engines. I could do some commenting this afternoon if someone wants to have a look. Russell
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.