| 1 | import { ChessRules } from "@/base_rules"; |
| 2 | |
| 3 | export class DiscoduelRules extends ChessRules { |
| 4 | |
| 5 | static get Options() { |
| 6 | return null; |
| 7 | } |
| 8 | |
| 9 | static get PawnSpecs() { |
| 10 | return Object.assign( |
| 11 | {}, |
| 12 | ChessRules.PawnSpecs, |
| 13 | { promotions: [V.PAWN] } |
| 14 | ); |
| 15 | } |
| 16 | |
| 17 | static get HasFlags() { |
| 18 | return false; |
| 19 | } |
| 20 | |
| 21 | scanKings() {} |
| 22 | |
| 23 | static GenRandInitFen() { |
| 24 | return "1n4n1/8/8/8/8/8/PPPPPPPP/8 w 0 -"; |
| 25 | } |
| 26 | |
| 27 | getPotentialMovesFrom(sq) { |
| 28 | const moves = super.getPotentialMovesFrom(sq); |
| 29 | if (this.turn == 'b') |
| 30 | // Prevent pawn captures on last rank: |
| 31 | return moves.filter(m => m.vanish.length == 1 || m.vanish[1].x != 0); |
| 32 | return moves; |
| 33 | } |
| 34 | |
| 35 | filterValid(moves) { |
| 36 | return moves; |
| 37 | } |
| 38 | |
| 39 | getCheckSquares() { |
| 40 | return []; |
| 41 | } |
| 42 | |
| 43 | getCurrentScore() { |
| 44 | // No real winning condition (promotions count...) |
| 45 | if (!this.atLeastOneMove()) return "1/2"; |
| 46 | return "*"; |
| 47 | } |
| 48 | |
| 49 | postPlay() {} |
| 50 | postUndo() {} |
| 51 | |
| 52 | static get SEARCH_DEPTH() { |
| 53 | return 4; |
| 54 | } |
| 55 | |
| 56 | }; |