- const whiteLine = (akPos[0] > 0 ? akPos[0] : "") + 'A' + (akPos < this.size.y - 1 ? ...);
- const blackLine = ...
- return baseFen.replace(...)
+ const antikingLine = (color) => {
+ const [idx, symbol] = (color == 'w' ? [0, 'a'] : [1, 'A']);
+ return (
+ (akPos[idx] > 0 ? akPos[idx] : "") + symbol +
+ (akPos[idx] < this.size.y - 1
+ ? C.FenEmptySquares(this.size.y - 1 - akPos[idx])
+ : "")
+ );
+ };
+ return (
+ baseFen.replace("p/8", "p/" + antikingLine('b'))
+ .replace("8/P", antikingLine('w') + "/P")
+ );