1 import ChessRules
from "/base_rules.js";
2 import AbstractAntikingRules
from "/variants/_Antiking/class.js";
3 import {Random
} from "/utils/alea.js";
5 export default class Antiking2Rules
extends AbstractAntikingRules
{
9 select: C
.Options
.select
,
10 styles: A
.Options
.styles
.concat("cylinder")
14 genRandInitFen(seed
) {
15 const baseFen
= super.genRandInitFen(seed
);
16 // Just add an antiking on 3rd ranks
18 if (this.options
.randomness
>= 1) {
19 akPos
[0] = Random
.randInt(this.size
.y
);
20 if (this.options
.randomness
== 2)
21 akPos
[1] = Random
.randInt(this.size
.y
);
25 const antikingLine
= (color
) => {
26 const [idx
, symbol
] = (color
== 'w' ? [0, 'a'] : [1, 'A']);
28 (akPos
[idx
] > 0 ? akPos
[idx
] : "") + symbol
+
29 (akPos
[idx
] < this.size
.y
- 1
30 ? C
.FenEmptySquares(this.size
.y
- 1 - akPos
[idx
])
35 baseFen
.replace("p/8", "p/" + antikingLine('b'))
36 .replace("8/P", antikingLine('w') + "/P")