diff --git a/package.json b/package.json index 462903e..82080cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chessgroundx", - "version": "10.6.2", + "version": "10.6.3", "description": "Extended lichess.org Chess UI", "type": "module", "module": "chessground.js", diff --git a/src/premove.ts b/src/premove.ts index 4eca7fe..c5604be 100644 --- a/src/premove.ts +++ b/src/premove.ts @@ -208,7 +208,7 @@ function ferzOuk(color: cg.Color): Mobility { (color === 'white' ? x1 === 4 && y1 === 0 && x2 === 4 && y2 === 2 : x1 === 3 && y1 === 7 && x2 === 3 && y2 === 5); } -// shatranj elephant +// alfil (shatranj elephant) const elephant: Mobility = (x1, y1, x2, y2) => { const xd = diff(x1, x2); const yd = diff(y1, y2); @@ -873,6 +873,29 @@ function builtinMobility( } }; + case 'shatranj': + return (boardState, key, canCastle) => { + const piece = boardState.pieces.get(key)!; + const role = piece.role; + const color = piece.color; + switch (role) { + case 'p-piece': // pawn + return pawnNoDoubleStep(color); + case 'r-piece': // rook + return rook; + case 'n-piece': // knight + return knight; + case 'b-piece': // bishop + return elephant; + case 'q-piece': // queen + return ferz; + case 'k-piece': // king + return kingNoCastling; + default: + return noMove; + } + }; + case 'grand': case 'grandhouse': return (boardState, key) => {