Author: Robert Hyatt
Date: 18:56:19 09/20/04
Go up one level in this thread
On September 20, 2004 at 20:22:36, Uri Blass wrote:
>On September 20, 2004 at 20:09:00, Andrew Platt wrote:
>
>>On September 20, 2004 at 19:40:23, Uri Blass wrote:
>>
>>>I see that Crafty handle FEN by the following command
>>>
>>>else if (strstr(input_buffer,"FEN"))
>>> {
>>> sprintf(buffer,"setboard %s",value);
>>> (void) Option(local[0]);
>>> continue;
>>> }
>>> return(1);
>>>
>>>I do not understand what it exactly does and what does Option (local[0]) does.
>>>
>>>Uri
>>
>>It's faking a setboard command and passing that to the Option routine that
>>processes input; Option reads from the variable 'buffer'. The Option routine
>>takes a parameter which is the current tree; I'm not that familiar with Crafty's
>>SMP code but it looks like that would be the main tree.
>>
>>Andy.
>
>Thanks but the question is what does Option does?
Option() parses and executes commands. In this case the "setboard" command that
uses the FEN data to set up the correct starting position for this particular
PGN game...
>I think that parallel code is not relevant here because I see no reason to use
>ReadPgn during games or analysis.
>I have function setboard that get a fen and put it as board position but I do
>not understand what Crafty exactly does.
>
>
>
>Another question is if there are no potential bugs in Crafty in reading pgn
>
>I found the following strings as global variables
>
>char pgn_event[32] = {"?"};
>char pgn_site[32] = {"?"};
>char pgn_round[32] = {"?"};
>char pgn_date[32] = {"????.??.??"};
>char pgn_white_elo[32] = {""};
>char pgn_white[64] = {"unknown"};
>char pgn_black_elo[32] = {""};
>char pgn_black[64] = {"crafty " VERSION};
>char pgn_result[32] = {"*"};
>
>Crafty also has value[128] as a local variable.
>
>I wonder what happens if the pgn has more than 32 chars in the pgn_event
>I am afraid that strcpy(pgn_event,value) that is used in Crafty will not work
>correctly in that case and Crafty use it in
>if (strstr(input_buffer,"Event")) strcpy(pgn_event,value);
>
>Same for other fields of the pgn.
>
>Uri
Certainly possible... Of course no matter how big you make 'em they can
overflow, or I could test the length for safety...
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.