6 return b
[1]=='a' ? "Antiking/"+b : b
;
9 static get ANTIKING() { return 'a'; }
13 super.initVariables(fen
);
14 // TODO: initialize this.antikingPos[...]
17 canTake(color1
, color2
, [x
,y
])
19 const piece
= this.getPiece(x
,y
);
20 return (piece
!= "a" && color1
!= color2
) || (piece
== "a" && color1
== color2
);
23 getPotentialMovesFrom([x
,y
])
25 let c
= this.getColor(x
,y
);
26 switch (this.getPiece(x
,y
))
28 case VariantRules
.ANTIKING:
29 return this.getPotentialAntikingMoves(x
,y
,c
);
31 return super.getPotentielMovesFrom([x
,y
]);
35 getPotentialAntikingMoves([x
,y
])
40 isAttacked(sq
, colors
)
42 return (super.isAttacked(sq
, colors
) || this.isAttackedByAntiking(sq
, colors
));
45 isAttackedByAntiking(sq
, color
)
54 let res
= this.isAttacked(this.kingPos
[c
], this.getOppCol(c
));
55 // TODO: also check that antiking is still in check
65 let res
= this.isAttacked(this.kingPos
[c
], this.getOppCol(c
))
66 ? [ JSON
.parse(JSON
.stringify(this.kingPos
[c
])) ]
72 // TODO: need antikingPos as well
78 unupdateVariables(move)
86 if (!this.isAttacked(this.kingPos
[color
], this.getOppCol(color
)))
88 return color
== "w" ? "0-1" : "1-0";
91 // Pieces values (TODO: use Object.assign() + ChessRules.VALUES ?)
104 static GenRandInitFen()
106 let randFen
= ChessRules
.GenRandInitFen();
107 // TODO: just add an antiking at random on 3rd ranks