diff --git a/package.json b/package.json index f5278a7..f1842c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chessgroundx", - "version": "10.5.1", + "version": "10.5.2", "description": "Extended lichess.org Chess UI", "type": "module", "module": "chessground.js", diff --git a/src/premove.ts b/src/premove.ts index 0d0d700..347b215 100644 --- a/src/premove.ts +++ b/src/premove.ts @@ -175,6 +175,10 @@ function pawnBerolina(color: cg.Color): Mobility { }; } +const pawnAtaxx: Mobility = (x1, y1, x2, y2) => { + return diff(x1, x2) <= 2 && diff(y1, y2) <= 2; +} + const sideways: Mobility = (x1, y1, x2, y2) => { return y1 === y2 && diff(x1, x2) <= 1; } @@ -609,6 +613,18 @@ function builtinMobility( bd: cg.BoardDimensions ): (boardState: cg.BoardState, key: cg.Key, canCastle: boolean) => Mobility { switch (variant) { + case 'ataxx': + return (boardState, key) => { + const piece = boardState.pieces.get(key)!; + const role = piece.role; + switch (role) { + case 'p-piece': // pawn + return pawnAtaxx; + default: + return noMove; + } + }; + case 'xiangqi': case 'manchu': return (boardState, key) => {