Skip to content

Commit

Permalink
Add makbug
Browse files Browse the repository at this point in the history
  • Loading branch information
gbtami committed Jan 14, 2025
1 parent 0a259f6 commit 55638f4
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 8 deletions.
46 changes: 44 additions & 2 deletions client/variants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,33 @@ export const VARIANTS: Record<string, Variant> = {
ui: { counting: "makruk", showPromoted: true },
}),

makrukhouse: variant({
name: "makrukhouse", tooltip: "Take captured pieces and drop them back on to the board as your own.",
startFen: "rnsmksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSKMSNR[] w - - 0 1",
icon: "Q",
boardFamily: "makruk8x8", pieceFamily: "makruk",
pieceRow: ["k", "s", "m", "n", "r", "p", "m~" as cg.Letter],
promotion: { type: "regular", order: ["m"] },
pocket: {
roles: ["p", "m", "s", "n", "r"],
captureToHand: true,
},
}),

makbug: variant({
name: "makbug", tooltip: "Thai bughouse chess", displayName: "makbug ᴮᴱᵀᴬ",
startFen: "rnsmksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSKMSNR[] w - - 0 1",
icon: "Q", twoBoards: true,
boardFamily: "makruk8x8", pieceFamily: "makruk",
pieceRow: ["k", "s", "m", "n", "r", "p", "m~" as cg.Letter],
promotion: { type: "regular", order: ["m"] },
pocket: {
roles: ["p", "m", "s", "n", "r"],
captureToHand: true,
},
ui: { showPromoted: true },
}),

makpong: variant({
name: "makpong", tooltip: "Makruk variant where kings cannot move to escape out of check.",
startFen: "rnsmksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSKMSNR w - - 0 1",
Expand Down Expand Up @@ -704,6 +731,21 @@ export const VARIANTS: Record<string, Variant> = {
promotion: { type: "regular", roles: [] },
}),

xiangqihouse: variant({
name: "xiangqihouse", tooltip: "Take captured pieces and drop them back on to the board as your own.",
startFen: "rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR[] w - - 0 1",
icon: "+",
boardFamily: "xiangqi9x10", pieceFamily: "xiangqi",
notation: cg.Notation.XIANGQI_ARBNUM,
colors: { first: "Red", second: "Black" },
pieceRow: ["k", "a", "c", "r", "b", "n", "p"],
promotion: { type: "regular", roles: [] },
pocket: {
roles: ["p", "n", "b", "r", "c", "a"],
captureToHand: true,
},
}),

supply: variant({
name: "supply", tooltip: "Chinese bughouse chess", displayName: "supply chess ᴮᴱᵀᴬ",
startFen: "rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR[] w - - 0 1",
Expand Down Expand Up @@ -1107,7 +1149,7 @@ export const VARIANTS: Record<string, Variant> = {
};

export const variants = Object.keys(VARIANTS);
const disabledVariants = [ "gothic", "gothhouse", "embassy", "embassyhouse", "gorogoro", "shinobi" ];
const disabledVariants = [ "gothic", "gothhouse", "embassy", "embassyhouse", "gorogoro", "shinobi", "makrukhouse", "xiangqihouse" ];
export const enabledVariants = variants.filter(v => !disabledVariants.includes(v));

// variants having 0 puzzle so far
Expand All @@ -1132,7 +1174,7 @@ export const twoBoarsVariants = variants.filter(v => VARIANTS[v].twoBoards);

export const variantGroups: { [ key: string ]: { variants: string[] } } = {
standard: { variants: [ "chess", "bughouse", "crazyhouse", "atomic", "kingofthehill", "3check", "antichess", "racingkings", "horde", "placement", "duck", "alice", "fogofwar" ] },
sea: { variants: [ "makruk", "makpong", "cambodian", "sittuyin", "asean" ] },
sea: { variants: [ "makruk", "makbug", "makpong", "cambodian", "sittuyin", "asean" ] },
shogi: { variants: [ "shogi", "minishogi", "kyotoshogi", "dobutsu", "gorogoroplus", "torishogi", "cannonshogi" ] },
xiangqi: { variants: [ "xiangqi", "supply", "manchu", "janggi", "minixiangqi" ] },
fairy: { variants: [ "shatranj", "capablanca", "capahouse", "dragon", "seirawan", "shouse", "grand", "grandhouse", "shako", "shogun", "hoppelpoppel", "mansindam" ] },
Expand Down
31 changes: 30 additions & 1 deletion client/variantsIni.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,33 @@ commoner = k
castlingKingPiece = k
# extinction rules prevents to get valid moves for fog FENs ceated on server side
#extinctionValue = loss
#extinctionPieceTypes = k`
#extinctionPieceTypes = k
# Hybrid variant of xiangqi and crazyhouse
[xiangqihouse:xiangqi]
startFen = rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR[] w - - 0 1
pieceDrops = true
capturesToHand = true
dropChecks = false
whiteDropRegion = *1 *2 *3 *4 *5
blackDropRegion = *6 *7 *8 *9 *10
mobilityRegionWhiteFers = d1 f1 e2 d3 f3
mobilityRegionBlackFers = d8 f8 e9 d10 f10
mobilityRegionWhiteElephant = c1 g1 a3 e3 i3 c5 g5
mobilityRegionBlackElephant = c6 g6 a8 e8 i8 c10 g10
mobilityRegionWhiteSoldier = a4 a5 c4 c5 e4 e5 g4 g5 i4 i5 *6 *7 *8 *9 *10
mobilityRegionBlackSoldier = *1 *2 *3 *4 *5 a6 a7 c6 c7 e6 e7 g6 g7 i6 i7
# Hybrid variant of makruk and crazyhouse
[makrukhouse:makruk]
startFen = rnsmksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSKMSNR[] w - - 0 1
pieceDrops = true
capturesToHand = true
firstRankPawnDrops = true
promotionZonePawnDrops = true
immobilityIllegal = true
[makbug:makrukhouse]
startFen = rnsmksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSKMSNR[] w - - 0 1
capturesToHand = false
twoBoards = true`
2 changes: 1 addition & 1 deletion server/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class GameStatus(IntEnum):
"shinobiplus",
"spartan",
),
"makruk": ("makruk", "makpong", "cambodian", "sittuyin", "asean"),
"makruk": ("makruk", "makbug", "makpong", "cambodian", "sittuyin", "asean"),
"shogi": (
"shogi",
"minishogi",
Expand Down
11 changes: 9 additions & 2 deletions server/fairy.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ def __init__(
self.sf = sf_alice if variant == "alice" else sf
self.chess960 = chess960
self.sfen = False
self.show_promoted = variant in ("makruk", "makpong", "cambodian", "bughouse", "supply")
self.show_promoted = variant in (
"makruk",
"makpong",
"cambodian",
"bughouse",
"supply",
"makbug",
)
self.legal_moves_need_history = variant in ("janggi", "ataxx")
self.nnue = initial_fen == ""
self.initial_fen = (
Expand Down Expand Up @@ -111,7 +118,7 @@ def start_fen(variant, chess960=False, disabled_fen=""):
else:
new_fen = sf.start_fen(variant)

if variant == "bughouse" or variant == "supply":
if variant in ("bughouse", "supply", "makbug"):
return new_fen + " | " + new_fen
elif variant == "manchu":
return MANCHU_R_FEN
Expand Down
7 changes: 5 additions & 2 deletions server/variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def __init__(self, variant):
FOGOFWAR = Variant("Q", "fogofwar", _("Fog of War"), "🌫")

MAKRUK = Variant("m", "makruk", _("Makruk"), "Q")
MAKRUKHOUSE = Variant("Ł", "makrukhouse", _("Makrukhouse"), "Q")
MAKBUG = Variant("ß", "makbug", _("Makbug"), "Q", two_boards=True, base_variant="makrukhouse") # fmt: skip
MAKPONG = Variant("l", "makpong", _("Makpong"), "O")
CAMBODIAN = Variant("b", "cambodian", _("Ouk Chaktrang"), "!")
SITTUYIN = Variant("y", "sittuyin", _("Sittuyin"), ":")
Expand All @@ -86,8 +88,8 @@ def __init__(self, variant):
CANNONSHOGI = Variant("W", "cannonshogi", _("Cannon Shogi"), "💣", byo=True)

XIANGQI = Variant("x", "xiangqi", _("Xiangqi"), "|", grand=True)
XIANGQIHOUSE = Variant("x", "xiangqihouse", _("Xiangqihouse"), "|", grand=True)
SUPPLY = Variant("@", "supply", _("Supply Chess"), "¢", grand=True, two_boards=True, base_variant="xiangqihouse") # fmt: skip
XIANGQIHOUSE = Variant("[", "xiangqihouse", _("Xiangqihouse"), "|", grand=True)
SUPPLY = Variant("@", "supply", _("Supply Chess"), "|", grand=True, two_boards=True, base_variant="xiangqihouse") # fmt: skip
MANCHU = Variant("M", "manchu", _("Manchu+"), "{", grand=True)
JANGGI = Variant("j", "janggi", _("Janggi"), "=", grand=True, byo=True)
MINIXIANGQI = Variant("e", "minixiangqi", _("Minixiangqi"), "7")
Expand Down Expand Up @@ -141,6 +143,7 @@ def get_server_variant(uci_variant, chess960):
ServerVariants.GOTHIC,
ServerVariants.GOTHHOUSE,
ServerVariants.SHINOBI,
ServerVariants.MAKRUKHOUSE,
ServerVariants.XIANGQIHOUSE,
)

Expand Down
14 changes: 14 additions & 0 deletions variants.ini
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,17 @@ mobilityRegionWhiteElephant = c1 g1 a3 e3 i3 c5 g5
mobilityRegionBlackElephant = c6 g6 a8 e8 i8 c10 g10
mobilityRegionWhiteSoldier = a4 a5 c4 c5 e4 e5 g4 g5 i4 i5 *6 *7 *8 *9 *10
mobilityRegionBlackSoldier = *1 *2 *3 *4 *5 a6 a7 c6 c7 e6 e7 g6 g7 i6 i7

# Hybrid variant of makruk and crazyhouse
[makrukhouse:makruk]
startFen = rnsmksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSKMSNR[] w - - 0 1
pieceDrops = true
capturesToHand = true
firstRankPawnDrops = true
promotionZonePawnDrops = true
immobilityIllegal = true

[makbug:makrukhouse]
startFen = rnsmksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSKMSNR[] w - - 0 1
capturesToHand = false
twoBoards = true

0 comments on commit 55638f4

Please sign in to comment.