1 import { ChessRules
} from "@/base_rules";
4 // Stage 1 {w, b} : 2 kings on board, value 5.
5 // Stage 2: only one, get mated and all that, value 1000
6 // ...But the middle king will get captured quickly...
8 export class DoublearmyRules
extends ChessRules
{
9 static get COMMONER() {
14 return ChessRules
.PIECES
.concat([V
.COMMONER
]);
18 return (b
[1] == V
.COMMONER
? "Doublearmy/" : "") + b
;
21 static GenRandInitFen(randomness
) {
22 const fen
= ChessRules
.GenRandInitFen(randomness
);
23 const rows
= fen
.split(" ")[0].split("/");
27 rows
[0].replace('k', 'c') + "/" +
30 rows
[7].replace('K', 'C') + "/" +
32 rows
[7] + fen
.slice(-11)
36 getPotentialMovesFrom([x
, y
]) {
37 switch (this.getPiece(x
, y
)) {
39 return this.getPotentialCommonerMoves([x
, y
]);
41 return super.getPotentialMovesFrom([x
, y
]);
45 getPotentialCommonerMoves(sq
) {
46 return this.getSlideNJumpMoves(
48 V
.steps
[V
.ROOK
].concat(V
.steps
[V
.BISHOP
]),
53 isAttacked(sq
, color
) {
55 super.isAttacked(sq
, color
) ||
56 this.isAttackedByCommoner(sq
, color
)
60 isAttackedByCommoner(sq
, color
) {
61 return this.isAttackedBySlideNJump(
65 V
.steps
[V
.ROOK
].concat(V
.steps
[V
.BISHOP
]),
78 static get SEARCH_DEPTH() {