piece = boards[yyboardindex]
[currentMoveString[1] - ONE][currentMoveString[0] - AAA];
+ if(PieceToChar(piece) == '+' && appData.icsActive) promoted = 1, yytext[skip3] = PieceToChar(DEMOTED piece); // trust ICS
if(promoted) piece = (ChessSquare) (DEMOTED piece);
c = PieceToChar(piece);
if(c == '~') c = PieceToChar((ChessSquare) (DEMOTED piece));
currentMoveString[4]);
if (currentMoveString[4] == NULLCHAR &&
- (result == WhitePromotionKnight || result == BlackPromotionKnight ||
- result == WhitePromotionQueen || result == BlackPromotionQueen)) {
- currentMoveString[4] = PieceToChar(BlackQueen);
+ (result == WhitePromotion || result == BlackPromotion)) {
+ if(gameInfo.variant == VariantCourier || gameInfo.variant == VariantShatranj)
+ currentMoveString[4] = PieceToChar(BlackFerz);
+ else if(gameInfo.variant == VariantGreat)
+ currentMoveString[4] = PieceToChar(BlackMan);
+ else if(gameInfo.variant == VariantShogi)
+ currentMoveString[4] = '+';
+ else
+ currentMoveString[4] = PieceToChar(BlackQueen);
currentMoveString[5] = NULLCHAR;
}
currentMoveString[4]);
if (currentMoveString[4] == NULLCHAR) {
- if(result == WhitePromotionKnight || result == BlackPromotionKnight ||
- result == WhitePromotionQueen || result == BlackPromotionQueen) {
+ if(result == WhitePromotion || result == BlackPromotion) {
if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk)
currentMoveString[4] = PieceToChar(BlackFerz);
else if(gameInfo.variant == VariantGreat)
currentMoveString[4] = PieceToChar(BlackMan);
+ else if(gameInfo.variant == VariantShogi)
+ currentMoveString[4] = '+'; // Queen might not be defined in mini variants!
else
currentMoveString[4] = PieceToChar(BlackQueen);
currentMoveString[5] = NULLCHAR;
}
} else if(appData.testLegality && // strip off unnecessary and false promo characters
- !(result == WhitePromotionQueen || result == BlackPromotionQueen ||
- result == WhiteNonPromotion || result == BlackNonPromotion)) currentMoveString[4] = NULLCHAR;
+ !(result == WhitePromotion || result == BlackPromotion ||
+ result == WhiteNonPromotion || result == BlackNonPromotion)) currentMoveString[4] = NULLCHAR;
return (int) result;
}
currentMoveString[4]);
if (currentMoveString[4] == NULLCHAR &&
- (result == WhitePromotionKnight || result == BlackPromotionKnight ||
- result == WhitePromotionQueen || result == BlackPromotionQueen)) {
+ (result == WhitePromotion || result == BlackPromotion)) {
if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk)
currentMoveString[4] = PieceToChar(BlackFerz);
else if(gameInfo.variant == VariantGreat)
else
currentMoveString[4] = PieceToChar(BlackQueen);
currentMoveString[5] = NULLCHAR;
- } else if(appData.testLegality && // strip off unnecessary and false promo characters
- !(result == WhitePromotionQueen || result == BlackPromotionQueen ||
- result == WhiteNonPromotion || result == BlackNonPromotion)) currentMoveString[4] = NULLCHAR;
+ }
return (int) result;
}
currentMoveString[4]);
if (currentMoveString[4] == NULLCHAR &&
- (result == WhitePromotionQueen || result == BlackPromotionQueen ||
- result == WhitePromotionKnight || result == BlackPromotionKnight)) {
+ (result == WhitePromotion || result == BlackPromotion)) {
currentMoveString[4] = PieceToChar(BlackQueen);
// [HGM] shatranj: take care of variants without Queen
if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk)
return (int) IllegalMove;
}
-"+"?[A-Z][xX:-]?[a-l][0-9]=? {
+"+"?[A-Z][xX:-]?[a-l][0-9]((=?\(?[A-Z]\)?)|=)? {
/*
* piece move, possibly ambiguous
*/
cl.promoCharIn = NULLCHAR;
if(yyleng-skip > 3) /* [HGM] can have Shogi-style promotion */
- cl.promoCharIn = yytext[yyleng-1];
+ cl.promoCharIn = yytext[yyleng-1-(yytext[yyleng-1]==')')];
if (appData.debugMode) {
fprintf(debugFP, "Parser Qa1: yyleng=%d, %d(%d,%d)-(%d,%d) = %d (%c)\n",
return (int) cl.kind;
}
-"+"?[A-Z][a-l0-9][xX:-]?[a-l][0-9]=? {
+"+"?[A-Z][a-l0-9][xX:-]?[a-l][0-9]((=?\(?[A-Z]\)?)|=)? {
/*
* piece move with rank or file disambiguator
*/
cl.promoCharIn = NULLCHAR;
if(yyleng-skip > 4) /* [HGM] can have Shogi-style promotion */
- cl.promoCharIn = yytext[yyleng-1];
+ cl.promoCharIn = yytext[yyleng-1-(yytext[yyleng-1]==')')];
/* [HGM] do not allow values beyond board size */
if(cl.rtIn >= BOARD_HEIGHT ||
}
}
if(PosFlags(0) & F_FRC_TYPE_CASTLING) {
+
if (WhiteOnMove(yyboardindex)) {
ff = initialRights[2];
ft = initialRights[1];
rf, ff, rt, ft, NULLCHAR);
}
-[A-Z][@*][a-l][0-9] {
+[A-Za-z][@*][a-l][0-9] {
/* Bughouse piece drop. */
currentMoveString[1] = '@';
currentMoveString[2] = yytext[2];