New variant idea
[xogo.git] / variants / Brotherhood / class.js
... / ...
CommitLineData
1import ChessRules from "/base_rules.js";
2
3export default class BrotherhoodRules extends ChessRules {
4
5 canTake([x1, y1], [x2, y2]) {
6 if (!super.canTake([x1, y1], [x2, y2]))
7 return false;
8 const p1 = this.getPiece(x1, y1),
9 p2 = this.getPiece(x2, y2);
10 return (p1 != p2 || ['p', 'k'].some(symb => [p1, p2].includes(symb)));
11 }
12
13 getCurrentScore() {
14 if (this.atLeastOneMove(this.turn))
15 return "*";
16 // Stalemate = loss
17 return (this.turn == 'w' ? "0-1" : "1-0");
18 }
19
20};