ec96a436de494af1cccf7b1d364a241dabeb1cfe
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 return this.board
[row_idx
].every(square
=> {
42 return (!square
|| square
.charAt(0) != 'w');
46 !this.atLeastOneMove(this.turn
)