In the WB menu it takes the place of the defunct Twilight Chess item.
The setup routine needed patching for setting up Lances in stead of
Pawns for black, the check test had to be adapted to handle duple check,
Alfil and Dragon moves were fine tuned in this variant to make the exact
moves, and the promotion popup was adapted to show King and interpret
Rook and Bishop as Dragon and Alfil for black. The Alfil now always
moves as Modern Elephant except in Shatranj and Courier.
BlackUnicorn, BlackBishop, BlackMan, BlackRook }
};
+ChessSquare SpartanArray[2][BOARD_FILES] = {
+ { WhiteRook, WhiteKnight, WhiteBishop, WhiteQueen,
+ WhiteKing, WhiteBishop, WhiteKnight, WhiteRook },
+ { BlackAlfil, BlackMarshall, BlackKing, BlackDragon,
+ BlackDragon, BlackKing, BlackAngel, BlackAlfil }
+};
+
ChessSquare fairyArray[2][BOARD_FILES] = { /* [HGM] Queen side differs from King side */
{ WhiteRook, WhiteKnight, WhiteBishop, WhiteQueen,
WhiteKing, WhiteBishop, WhiteKnight, WhiteRook },
case VariantSuper: /* experimental */
case VariantGreat: /* experimental, requires legality testing to be off */
case VariantSChess: /* S-Chess, should work */
+ case VariantSpartan: /* should work */
break;
}
}
pieces = KnightmateArray;
SetCharTable(pieceToChar, "P.BRQ.....M.........K.p.brq.....m.........k.");
break;
+ case VariantSpartan:
+ pieces = SpartanArray;
+ SetCharTable(pieceToChar, "PNBRQ................K......lwg.....c...h..k");
+ break;
case VariantFairy:
pieces = fairyArray;
SetCharTable(pieceToChar, "PNBRQFEACWMOHIJGDVLSUKpnbrqfeacwmohijgdvlsuk");
if(j < BOARD_LEFT || j >= BOARD_RGHT || overrule) continue;
initialPosition[0][j] = pieces[0][j-gameInfo.holdingsWidth];
initialPosition[pawnRow][j] = WhitePawn;
- initialPosition[BOARD_HEIGHT-pawnRow-1][j] = BlackPawn;
+ initialPosition[BOARD_HEIGHT-pawnRow-1][j] = gameInfo.variant == VariantSpartan ? BlackLance : BlackPawn;
if(gameInfo.variant == VariantXiangqi) {
if(j&1) {
initialPosition[pawnRow][j] =
VariantTwilight,
VariantMakruk,
VariantSChess,
+ VariantSpartan,
VariantUnknown /* Catchall for other unknown variants */
} VariantClass;
"twilight",\
"makruk",\
"seirawan",\
+ "spartan",\
"unknown" \
}
for (rf = 0; rf < BOARD_HEIGHT; rf++)
for (ff = BOARD_LEFT; ff < BOARD_RGHT; ff++) {
ChessSquare piece;
+ int rookRange = 1000;
if (flags & F_WHITE_ON_MOVE) {
if (!WhitePiece(board[rf][ff])) continue;
&& !SameColor(board[rf][ff], board[rt][ft]))
callback(board, flags, NormalMove,
rf, ff, rt, ft, closure);
- if(gameInfo.variant != VariantFairy && gameInfo.variant != VariantGreat) continue;
+ if(gameInfo.variant == VariantShatranj && gameInfo.variant == VariantCourier) continue; // classical Alfil
rt = rf + rs; // in unknown variant we assume Modern Elephant, which can also do one step
ft = ff + fs;
if (!(rt < 0 || rt >= BOARD_HEIGHT || ft < BOARD_LEFT || ft >= BOARD_RGHT)
callback(board, flags, NormalMove,
rf, ff, rt, ft, closure);
}
+ if(gameInfo.variant == VariantSpartan)
+ for(fs = -1; fs <= 1; fs += 2) {
+ ft = ff + fs;
+ if (!(ft < BOARD_LEFT || ft >= BOARD_RGHT) && board[rf][ft] == EmptySquare)
+ callback(board, flags, NormalMove, rf, ff, rf, ft, closure);
+ }
break;
/* Make Dragon-Horse also do Dababba moves outside Shogi, for better disambiguation in variant Fairy */
if (SameColor(board[rf][ff], board[rt][ft])) continue;
callback(board, flags, NormalMove, rf, ff, rt, ft, closure);
}
+ if(gameInfo.variant == VariantSpartan) rookRange = 2; // in Spartan Chess restrict range to modern Dababba
goto doRook;
/* Shogi Dragon King has to continue as Ferz after Rook moves */
case WhiteMarshall:
case BlackMarshall:
m++;
+ m += (gameInfo.variant == VariantSpartan); // in Spartan Chess Chancellor is used for Dragon King.
/* Shogi Rooks are ordinary Rooks */
case SHOGI WhiteRook:
if (SameColor(board[rf][ff], board[rt][ft])) break;
callback(board, flags, NormalMove,
rf, ff, rt, ft, closure);
- if (board[rt][ft] != EmptySquare) break;
+ if (board[rt][ft] != EmptySquare || i == rookRange) break;
}
if(m==1) goto mounted;
if(m==2) goto finishSilver;
/* For compatibility with ICS wild 9, we scan the board in the
order a1, a2, a3, ... b1, b2, ..., h8 to find the first king,
and we test only whether that one is in check. */
- cl.check = 0;
for (cl.fking = BOARD_LEFT+0; cl.fking < BOARD_RGHT; cl.fking++)
for (cl.rking = 0; cl.rking < BOARD_HEIGHT; cl.rking++) {
if (board[cl.rking][cl.fking] == king) {
board[i][cl.fking] == (dir>0 ? BlackWazir : WhiteWazir) )
cl.check++;
}
-
+ cl.check = 0;
GenPseudoLegal(board, flags ^ F_WHITE_ON_MOVE, CheckTestCallback, (VOIDSTAR) &cl);
- goto undo_move; /* 2-level break */
+ if(gameInfo.variant != VariantSpartan || cl.check == 0) // in Spartan Chess go on to test if other King is checked too
+ goto undo_move; /* 2-level break */
}
}
"cra&zyhouse" === ""\r
"&bughouse" === ""\r
"&Twilight" === ""\r
+"Sp&artan" === ""\r
"&shogi" === ""\r
"su&per" === ""\r
"&knightmate" === ""\r
Translate(hDlg, DLG_PromotionKing);\r
ShowWindow(GetDlgItem(hDlg, PB_King), \r
(!appData.testLegality || gameInfo.variant == VariantSuicide ||\r
+ gameInfo.variant == VariantSpartan && !WhiteOnMove(currentMove) ||\r
gameInfo.variant == VariantGiveaway || gameInfo.variant == VariantSuper ) ?\r
SW_SHOW : SW_HIDE);\r
/* [HGM] Only allow C & A promotions if these pieces are defined */\r
break;\r
case PB_Rook:\r
promoChar = ToLower(PieceToChar(WhiteOnMove(currentMove) ? WhiteRook : BlackRook));\r
+ if(gameInfo.variant == VariantSpartan && !WhiteOnMove(currentMove)) promoChar = PieceToChar(BlackDragon);\r
break;\r
case PB_Bishop:\r
promoChar = ToLower(PieceToChar(WhiteOnMove(currentMove) ? WhiteBishop : BlackBishop));\r
+ if(gameInfo.variant == VariantSpartan && !WhiteOnMove(currentMove)) promoChar = PieceToChar(BlackAlfil);\r
break;\r
case PB_Chancellor:\r
promoChar = ToLower(PieceToChar(WhiteOnMove(currentMove) ? WhiteMarshall : BlackMarshall));\r
70,10\r
CONTROL "&bughouse",OPT_VariantBughouse,"Button",BS_AUTORADIOBUTTON,80,24,70,\r
10\r
- CONTROL "&Twilight",OPT_VariantTwilight,"Button",BS_AUTORADIOBUTTON,80,34,70,\r
+ CONTROL "Sp&artan",OPT_VariantTwilight,"Button",BS_AUTORADIOBUTTON,80,34,70,\r
10\r
CONTROL "&shogi",OPT_VariantShogi,"Button",BS_AUTORADIOBUTTON,80,\r
44,70,10\r
(IsDlgButtonChecked(hDlg, OPT_Variant3Check) ? Variant3Check :\r
(IsDlgButtonChecked(hDlg, OPT_VariantGreat) ? VariantGreat :\r
(IsDlgButtonChecked(hDlg, OPT_VariantGiveaway) ? VariantGiveaway :\r
- (IsDlgButtonChecked(hDlg, OPT_VariantTwilight) ? VariantTwilight :\r
+ (IsDlgButtonChecked(hDlg, OPT_VariantTwilight) ? VariantSpartan :\r
(IsDlgButtonChecked(hDlg, OPT_VariantMakruk) ? VariantMakruk :\r
(IsDlgButtonChecked(hDlg, OPT_VariantSChess) ? VariantSChess :\r
VariantNormal ))))))))))))))))))))))))))))));\r
case VariantGiveaway:\r
CheckDlgButton(hDlg, OPT_VariantGiveaway, TRUE);\r
break;\r
- case VariantTwilight:\r
+ case VariantSpartan:\r
CheckDlgButton(hDlg, OPT_VariantTwilight, TRUE);\r
break;\r
case VariantMakruk:\r
layout, args, j);
if(gameInfo.variant != VariantShogi) {
+ if(gameInfo.variant == VariantSpartan && !WhiteOnMove(currentMove)) {
+ XawDialogAddButton(dialog, _("Warlord"), PromotionCallback,
+ (XtPointer) dialog);
+ XawDialogAddButton(dialog, _("General"), PromotionCallback,
+ (XtPointer) dialog);
+ XawDialogAddButton(dialog, _("Lieutenant"), PromotionCallback,
+ (XtPointer) dialog);
+ XawDialogAddButton(dialog, _("Captain"), PromotionCallback,
+ (XtPointer) dialog);
+ } else {\r
XawDialogAddButton(dialog, _("Queen"), PromotionCallback,
(XtPointer) dialog);
XawDialogAddButton(dialog, _("Rook"), PromotionCallback,
(XtPointer) dialog);
XawDialogAddButton(dialog, _("Knight"), PromotionCallback,
(XtPointer) dialog);
+ }
if (!appData.testLegality || gameInfo.variant == VariantSuicide ||
+ gameInfo.variant == VariantSpartan && !WhiteOnMove(currentMove) ||\r
gameInfo.variant == VariantGiveaway) {
XawDialogAddButton(dialog, _("King"), PromotionCallback,
(XtPointer) dialog);
#ifdef FALCON
{N_("Falcon (10x8)"), "#BFBFFF", 0, VariantFalcon},
#endif
+ {N_("Spartan"), "#FF0000", 0, VariantSpartan},
{NULL, 0, 0, (VariantClass) 0}
};