{label: "Random", value: 1}
]
}],
+ input: [
+ {
+ label: "Pawn first",
+ variable: "pawnfirst",
+ type: "checkbox",
+ defaut: false
+ }
+ ],
styles: ["atomic", "capture", "cylinder"]
};
}
// Just do not update any reserve (infinite supply)
updateReserve() {}
+ canDrop([c, p], [i, j]) {
+ return (
+ this.board[i][j] == "" &&
+ (
+ p != "p" || this.options["pawnfirst"] ||
+ (c == 'w' && i < this.size.x - 1) ||
+ (c == 'b' && i > 0)
+ )
+ );
+ }
+
getCurrentScore(move_s) {
const score = super.getCurrentScore(move_s);
if (score != "*")
const res = super.getCurrentScore(move_s);
if (res != '*')
return res;
- const oppCol = C.GetOppTurn(this.turn);
- const oppLastRank = (oppCol == 'b' ? 3 : 0);
- for (let j=0; j < this.size.y; j++) {
- if (this.board[oppLastRank][j] == oppCol + 'k')
- return (oppCol == 'w' ? "1-0" : "0-1");
+ for (let lastRank of [0, 3]) {
+ const color = (lastRank == 0 ? 'w' : 'b');
+ for (let j=0; j < this.size.y; j++) {
+ if (
+ this.board[lastRank][j] == color + 'k' &&
+ !this.underAttack([lastRank, j], [C.GetOppTurn(color)])
+ ) {
+ return (color == 'w' ? "1-0" : "0-1");
+ }
+ }
}
return "*";
}