0e6a3e567ae212a6f2e9d86b85caf0e6275ea91a
[xogo.git] / variants / Antiking2 / class.js
1 import ChessRules from "/base_rules.js";
2 import AbstractAntikingRules from "/variants/AbstractAntiking.js";
3 import { Random } from "/utils/alea.js";
4
5 export class Antiking2Rules extends AbstractAntikingRules {
6
7 static get Aliases() {
8 return Object.assign({'A': AbstractAntikingRules}, ChessRules.Aliases);
9 }
10
11 static get Options() {
12 return {
13 styles: A.Options.styles.concat("cylinder")
14 };
15 }
16
17 genRandInitFen(seed) {
18 const baseFen = super.genRandInitFen(seed);
19 // Just add an antiking on 3rd ranks
20 let akPos = [3, 3];
21 if (this.options.randomness >= 1) {
22 akPos[0] = Random.randInt(this.size.y);
23 if (this.options.randomness == 2)
24 akPos[1] = Random.randInt(this.size.y);
25 else
26 akPos[1] = akPos[0];
27 }
28 const whiteLine = (akPos[0] > 0 ? akPos[0] : "") + 'A' + (akPos < this.size.y - 1 ? ...);
29 const blackLine = ...
30 return baseFen.replace(...)
31 }
32
33 };