case VariantNoCastle:
case VariantShatranj:
case VariantCourier:
+ case VariantMakruk:
flags &= ~F_ALL_CASTLE_OK;
break;
default:
BlackFerz, BlackAlfil, BlackKnight, BlackRook }
};
+ChessSquare makrukArray[2][BOARD_SIZE] = { /* [HGM] (movGen knows about Shatranj Q and P) */
+ { WhiteRook, WhiteKnight, WhiteMan, WhiteKing,
+ WhiteFerz, WhiteMan, WhiteKnight, WhiteRook },
+ { BlackRook, BlackKnight, BlackMan, BlackFerz,
+ BlackKing, BlackMan, BlackKnight, BlackRook }
+};
+
#if (BOARD_SIZE>=10)
ChessSquare ShogiArray[2][BOARD_SIZE] = {
case VariantAtomic: /* should work except for win condition */
case Variant3Check: /* should work except for win condition */
case VariantShatranj: /* should work except for all win conditions */
+ case VariantMakruk: /* should work except for daw countdown */
case VariantBerolina: /* might work if TestLegality is off */
case VariantCapaRandom: /* should work */
case VariantJanus: /* should work */
case BlackPromotionChancellor:
case WhitePromotionArchbishop:
case BlackPromotionArchbishop:
- if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier)
+ if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk)
sprintf(user_move, "%c%c%c%c=%c\n",
AAA + fromX, ONE + fromY, AAA + toX, ONE + toY,
PieceToChar(WhiteFerz));
nrCastlingRights = 0;
SetCharTable(pieceToChar, "PN.R.QB...Kpn.r.qb...k");
break;
+ case VariantMakruk:
+ pieces = makrukArray;
+ nrCastlingRights = 0;
+ startedFromSetupPosition = TRUE;
+ SetCharTable(pieceToChar, "PN.R.M....SKpn.r.m....sk");
+ break;
case VariantTwoKings:
pieces = twoKingsArray;
break;
pawnRow = gameInfo.boardHeight - 7; /* seems to work in all common variants */
if(pawnRow < 1) pawnRow = 1;
+ if(gameInfo.variant == VariantMakruk) pawnRow = 2;
/* User pieceToChar list overrules defaults */
if(appData.pieceToCharTable != NULL)
if(gameInfo.variant == VariantShogi) {
promotionZoneSize = 3;
highestPromotingPiece = (int)WhiteFerz;
+ } else if(gameInfo.variant == VariantMakruk) {
+ promotionZoneSize = 3;
}
// next weed out all moves that do not touch the promotion zone at all
}
// we either have a choice what to promote to, or (in Shogi) whether to promote
- if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier) {
+ if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk) {
*promoChoice = PieceToChar(BlackFerz); // no choice
return FALSE;
}
char *ep;
{
ChessSquare captured = board[toY][toX], piece, king; int p, oldEP = EP_NONE, berolina = 0;
+ int promoRank = gameInfo.variant == VariantMakruk ? 3 : 1;
/* [HGM] compute & store e.p. status and castling rights for new position */
/* we can always do that 'in place', now pointers to these rights are passed to ApplyMove */
}
/* [HGM] In Shatranj and Courier all promotions are to Ferz */
- if((gameInfo.variant==VariantShatranj || gameInfo.variant==VariantCourier)
+ if((gameInfo.variant==VariantShatranj || gameInfo.variant==VariantCourier || gameInfo.variant == VariantMakruk)
&& promoChar != 0) promoChar = PieceToChar(WhiteFerz);
if (fromX == toX && fromY == toY) return;
board[toY][toX+1] = board[fromY][BOARD_LEFT];
board[fromY][BOARD_LEFT] = EmptySquare;
} else if (board[fromY][fromX] == WhitePawn
- && toY == BOARD_HEIGHT-1
+ && toY >= BOARD_HEIGHT-promoRank
&& gameInfo.variant != VariantXiangqi
) {
/* white pawn promotion */
board[fromY][0] = EmptySquare;
board[toY][2] = BlackRook;
} else if (board[fromY][fromX] == BlackPawn
- && toY == 0
+ && toY < promoRank
&& gameInfo.variant != VariantXiangqi
) {
/* black pawn promotion */
- board[0][toX] = CharToPiece(ToLower(promoChar));
- if (board[0][toX] == EmptySquare) {
- board[0][toX] = BlackQueen;
+ board[toY][toX] = CharToPiece(ToLower(promoChar));
+ if (board[toY][toX] == EmptySquare) {
+ board[toY][toX] = BlackQueen;
}
if(gameInfo.variant==VariantBughouse ||
gameInfo.variant==VariantCrazyhouse) /* [HGM] use shadow piece */
case BlackQueen:
if(gameInfo.variant == VariantShatranj ||
gameInfo.variant == VariantXiangqi ||
- gameInfo.variant == VariantCourier )
+ gameInfo.variant == VariantCourier ||
+ gameInfo.variant == VariantMakruk )
selection = (ChessSquare)((int)selection - (int)WhiteQueen + (int)WhiteFerz);
goto defaultlabel;
}
if(gameInfo.variant != VariantShogi && gameInfo.variant != VariantXiangqi &&
- gameInfo.variant != VariantShatranj && gameInfo.variant != VariantCourier ) {
+ gameInfo.variant != VariantShatranj && gameInfo.variant != VariantCourier && gameInfo.variant != VariantMakruk ) {
/* En passant target square */
if (move > backwardMostMove) {
fromX = moveList[move - 1][0] - AAA;
/* read e.p. field in games that know e.p. capture */
if(gameInfo.variant != VariantShogi && gameInfo.variant != VariantXiangqi &&
- gameInfo.variant != VariantShatranj && gameInfo.variant != VariantCourier ) {
+ gameInfo.variant != VariantShatranj && gameInfo.variant != VariantCourier && gameInfo.variant != VariantMakruk ) {
if(*p=='-') {
p++; FENepStatus = EP_NONE;
} else {
VariantSuper,
VariantGreat,
VariantTwilight,
+ VariantMakruk,
VariantUnknown /* Catchall for other unknown variants */
} VariantClass;
"super",\
"great",\
"twilight",\
+ "makruk",\
"unknown" \
}
{
int rf, ff;
int i, j, d, s, fs, rs, rt, ft, m;
+ int promoRank = gameInfo.variant == VariantMakruk ? 3 : 1;
for (rf = 0; rf < BOARD_HEIGHT; rf++)
for (ff = BOARD_LEFT; ff < BOARD_RGHT; ff++) {
}
if (rf < BOARD_HEIGHT-1 && board[rf + 1][ff] == EmptySquare) {
callback(board, flags,
- rf == BOARD_HEIGHT-2 ? WhitePromotionQueen : NormalMove,
+ rf >= BOARD_HEIGHT-1-promoRank ? WhitePromotionQueen : NormalMove,
rf, ff, rf + 1, ff, closure);
}
if (rf == 1 && board[2][ff] == EmptySquare &&
((flags & F_KRIEGSPIEL_CAPTURE) ||
BlackPiece(board[rf + 1][ff + s]))) {
callback(board, flags,
- rf == BOARD_HEIGHT-2 ? WhitePromotionQueen : NormalMove,
+ rf >= BOARD_HEIGHT-1-promoRank ? WhitePromotionQueen : NormalMove,
rf, ff, rf + 1, ff + s, closure);
}
if (rf == BOARD_HEIGHT-4) {
}
if (rf > 0 && board[rf - 1][ff] == EmptySquare) {
callback(board, flags,
- rf == 1 ? BlackPromotionQueen : NormalMove,
+ rf <= promoRank ? BlackPromotionQueen : NormalMove,
rf, ff, rf - 1, ff, closure);
}
if (rf == BOARD_HEIGHT-2 && board[BOARD_HEIGHT-3][ff] == EmptySquare &&
((flags & F_KRIEGSPIEL_CAPTURE) ||
WhitePiece(board[rf - 1][ff + s]))) {
callback(board, flags,
- rf == 1 ? BlackPromotionQueen : NormalMove,
+ rf <= promoRank ? BlackPromotionQueen : NormalMove,
rf, ff, rf - 1, ff + s, closure);
}
if (rf == 3) {
/* Shogi Pawn and Silver General: first the Pawn move, */
/* then the General continues like a Ferz */
+ case WhiteMan:
+ if(gameInfo.variant != VariantMakruk) goto commoner;
case SHOGI WhitePawn:
case SHOGI WhiteFerz:
if (rf < BOARD_HEIGHT-1 &&
if(piece != SHOGI WhitePawn) goto finishSilver;
break;
+ case BlackMan:
+ if(gameInfo.variant != VariantMakruk) goto commoner;
case SHOGI BlackPawn:
case SHOGI BlackFerz:
if (rf > 0 &&
case WhiteSilver:
case BlackSilver:
m++; // [HGM] superchess: use for Centaur
- case WhiteMan:
- case BlackMan:
+ commoner:
case SHOGI WhiteKing:
case SHOGI BlackKing:
case WhiteKing:
if (currentMoveString[4] == NULLCHAR &&\r
(result == WhitePromotionKnight || result == BlackPromotionKnight ||\r
result == WhitePromotionQueen || result == BlackPromotionQueen)) {\r
- if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier)\r
+ if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk)\r
currentMoveString[4] = PieceToChar(BlackFerz);\r
else if(gameInfo.variant == VariantGreat)\r
currentMoveString[4] = PieceToChar(BlackMan);\r
result == WhitePromotionKnight || result == BlackPromotionKnight)) {\r
currentMoveString[4] = PieceToChar(BlackQueen);\r
// [HGM] shatranj: take care of variants without Queen\r
- if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier)\r
+ if(gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || gameInfo.variant == VariantMakruk)\r
currentMoveString[4] = PieceToChar(BlackFerz);\r
if(gameInfo.variant == VariantGreat)\r
currentMoveString[4] = PieceToChar(BlackMan);\r
</td></tr><tr><td>\r
<font color="#008000">knightmate</font></td><td><font color="#008000">King moves a Knight, and vice versa</font>\r
</td></tr><tr><td>\r
+<font color="#3333ff">makruk</font></td><td><font color="#3333ff">Thai Chess (shatranj-like, pawns promote on 6th rank)</font>\r
+</td></tr><tr><td>\r
<font color="#3333ff">super</font></td><td><font color="#3333ff">Superchess, a shuffle variant with B+N, R+N, K+N and Q+N compound</font>\r
</td></tr><tr><td>\r
<font color="#3333ff">great</font></td><td><font color="#3333ff">Great Shatranj, whithout sliders, on 10x8 board (legality testing off!)</font>\r
#define OPT_Variant3Check 1526\r
#define OPT_VariantGreat 1527\r
#define OPT_VariantTwilight 1528\r
+#define OPT_VariantMakruk 1529\r
#define IDC_Files 1550\r
#define IDC_Ranks 1551\r
#define IDC_Holdings 1552\r
84,50,10\r
CONTROL "&fairy",OPT_VariantFairy,"Button",BS_AUTORADIOBUTTON,70,\r
94,50,10\r
+ CONTROL "&makruk",OPT_VariantMakruk,"Button",BS_AUTORADIOBUTTON,70,\r
+ 104,50,10\r
CONTROL "&gothic",OPT_VariantGothic,"Button",BS_AUTORADIOBUTTON,134,14,\r
50,10\r
CONTROL "&capablanca",OPT_VariantCapablanca,"Button",BS_AUTORADIOBUTTON,134,\r
(IsDlgButtonChecked(hDlg, OPT_VariantGreat) ? VariantGreat :\r
(IsDlgButtonChecked(hDlg, OPT_VariantGiveaway) ? VariantGiveaway :\r
(IsDlgButtonChecked(hDlg, OPT_VariantTwilight) ? VariantTwilight :\r
- VariantNormal ))))))))))))))))))))))))))));\r
+ (IsDlgButtonChecked(hDlg, OPT_VariantMakruk) ? VariantMakruk :\r
+ VariantNormal )))))))))))))))))))))))))))));\r
}\r
\r
LRESULT CALLBACK\r
case VariantTwilight:\r
CheckDlgButton(hDlg, OPT_VariantTwilight, TRUE);\r
break;\r
+ case VariantMakruk:\r
+ CheckDlgButton(hDlg, OPT_VariantMakruk, TRUE);\r
+ break;\r
default: ;\r
}\r
\r
cylinder Pieces wrap around the board edge
knightmate King moves as Knight, and vice versa
super Superchess (shuffle variant with 4 exo-pieces)
+makruk Thai Chess (shatranj-like, P promotes on 6th rank)
fairy A catchall variant in which all piece types
known to XBoard can participate (8x8)
unknown Catchall for other unknown variants
{N_("berolina"), "#FFFFFF", 0, VariantBerolina},
{N_("cylinder"), "#FFFFFF", 0, VariantCylinder},
{N_("shatranj"), "#FFFFFF", 0, VariantShatranj},
+ {N_("makruk"), "#FFFFFF", 0, VariantMakruk},
{N_("atomic"), "#FFFFFF", 0, VariantAtomic},
{N_("two kings"), "#FFFFFF", 0, VariantTwoKings},
{N_("3-checks"), "#FFFFFF", 0, Variant3Check},