1 import ChessRules
from "/base_rules.js";
2 import {ArrayFun
} from "/utils/array.js"
4 export default class DiscoduelRules
extends ChessRules
{
7 return {}; //nothing would make sense
10 get pawnPromotions() {
18 genRandInitBaseFen() {
20 fen: "1n4n1/8/8/8/8/8/PPPPPPPP/8",
25 getPotentialMovesFrom([x
, y
]) {
26 const moves
= super.getPotentialMovesFrom([x
, y
]);
28 // Prevent pawn captures on last rank:
29 return moves
.filter(m
=> m
.vanish
.length
== 1 || m
.vanish
[1].x
!= 0);
38 // No real winning condition (promotions count...)
40 ArrayFun
.range(1, this.size
.x
).every(row_idx
=> {
41 this.board
[row_idx
].every(square
=> square
.charAt(0) != 'w')
44 !this.atLeastOneMove(this.turn
)