[Top][All Lists]

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

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

From: Adam
Subject: Re: [Bug-gnubg] Looking For Some Example Code
Date: Thu, 12 Aug 2004 09:28:36 -0400

Thank you, this is a great idea! Does the resulting "possible" board also handle checking for bumps?


On Aug 12, 2004, at 2:17 AM, Jim Segrave wrote:

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]