[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnubg] Looking For Some Example Code

From: Jim Segrave
Subject: Re: [Bug-gnubg] Looking For Some Example Code
Date: Thu, 12 Aug 2004 08:17:40 +0200
User-agent: Mutt/1.4.1i

On Wed 11 Aug 2004 (23:24 -0400), Adam wrote:
> Where in the source can I find the code that checks if a player has 
> made a legal move?

play.c CommandMove() begins on line 2967.

At line 3080     if( ( c = ParseMove( sz, an ) ) > 0 ) {

here if parses the submitted move, then makes a copy of the current
board position in anBoardNew[][] updating it with the move

It then calls GenerateMoves() to get a list of legal moves. For each
legal move, which is supplied with a position key for the resulting
board, it generates anBoardTest[][] and compares it to the position
resulting from the submitted move in anBoardNew[][]. If it finds a
match, it has found a legal move.

Jim Segrave           address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]