I'm a french student of 22 years old, in Master 1 of Informatic.
Under a project for my studies, I develop with another person a new variant call TwilightChess based on crazyhouse board, and an corresponding engine based on fruit 2.1, and polyglot. I haven't encountered any problem for the development of rules, although I am far from finished. But I have encoutered a big problem when I started watching the loading of a game, especially parser.l and parser.c files.
I think paser.c is generated by the parser.l file, but how I can't find the program that could do that I manually add rule in the parser.c. And unfortunately I have only segfaults after building.
I have search on the forum but I didn't find any subject related to this problem.
That is the line that I've added in parser.l just after the bughouse rules to drop a pawn :
- Code: Select all
[a-l][0-9][@*][A-Z] {
/* Twilight piece warp. No legality checking for now. */
currentMoveString[0] = yytext[0];
currentMoveString[1] = yytext[1];
currentMoveString[2] = '@';
currentMoveString[4] = NULLCHAR;
if (appData.debugMode) {
fprintf(debugFP, "Warp: %s\n", currentMoveString);
}
/* [HGM] do not allow values beyond board size */
if(currentMoveString[1] - ONE >= BOARD_HEIGHT ||
currentMoveString[0] - AAA >= BOARD_WIDTH )
return 0;
if (WhiteOnMove(yyboardindex)) {
currentMoveString[3] = ToUpper(yytext[3]);
return (int) WhiteWarp;
}
else {
currentMoveString[3] = ToLower(yytext[3]);
return (int) BlackWarp;
}
}
I've set this two variables with their new values in parser.c :
- Code: Select all
#define YY_NUM_RULES 43
#define YY_END_OF_BUFFER 44
And that is the line that I've added in parser.c just after the bughouse rules to drop a pawn :
- Code: Select all
*####################################################################*/
/*Begin TwilightChess change*/
case 11:
YY_RULE_SETUP
{
fprintf(debugFP, "###############################\n"
"Dans le parser pour le WARP !\n"
"###############################\n");
currentMoveString[0] = yytext[0];
currentMoveString[1] = yytext[1];
currentMoveString[2] = '@';
currentMoveString[3] = NULLCHAR;
currentMoveString[4] = NULLCHAR;
fprintf(debugFP, "###############################\n"
"%s\n"
"###############################\n",yytext);
if (appData.debugMode) {
fprintf(debugFP, "Warp: %s\n", currentMoveString);
}
if(currentMoveString[1] - ONE >= BOARD_HEIGHT ||
currentMoveString[0] - AAA >= BOARD_WIDTH ) {
return 0;
}
if (WhiteOnMove(yyboardindex)) {
currentMoveString[3] = ToUpper(yytext[3]);
return (int) WhiteWarp;
}
else {
currentMoveString[3] = ToLower(yytext[3]);
return (int) BlackWarp;
}
}
YY_BREAK
/*End TwilightChess change*/
/*####################################################################*/
To finish I thank you for your answers, and excuse me if I didn't put my message in the right section, and excuse me for my weak English.
Best regards,
Anthony.