| 1 | import { ChessRules } from "@/base_rules"; |
| 2 | |
| 3 | export class BrotherhoodRules extends ChessRules { |
| 4 | |
| 5 | getPotentialMovesFrom([x, y]) { |
| 6 | return ( |
| 7 | super.getPotentialMovesFrom([x, y]).filter(m => { |
| 8 | // Forbid capturing same piece's type: |
| 9 | return ( |
| 10 | m.vanish.length == 1 || |
| 11 | [V.PAWN, V.KING].includes(m.vanish[0].p) || |
| 12 | m.vanish[1].p != m.vanish[0].p |
| 13 | ); |
| 14 | }) |
| 15 | ); |
| 16 | } |
| 17 | |
| 18 | getCurrentScore() { |
| 19 | if (this.atLeastOneMove()) return "*"; |
| 20 | // Game over |
| 21 | return (this.turn == "w" ? "0-1" : "1-0"); |
| 22 | } |
| 23 | |
| 24 | }; |