projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Alice: fix castling notation
[vchess.git]
/
client
/
src
/
variants
/
Benedict.js
diff --git
a/client/src/variants/Benedict.js
b/client/src/variants/Benedict.js
index
fbc4b48
..
40d7a09
100644
(file)
--- a/
client/src/variants/Benedict.js
+++ b/
client/src/variants/Benedict.js
@@
-1,6
+1,7
@@
import { ChessRules, PiPo, Move } from "@/base_rules";
export class BenedictRules extends ChessRules {
import { ChessRules, PiPo, Move } from "@/base_rules";
export class BenedictRules extends ChessRules {
+
static get HasEnpassant() {
return false;
}
static get HasEnpassant() {
return false;
}
@@
-135,13
+136,10
@@
export class BenedictRules extends ChessRules {
// Stop at the first move found
atLeastOneMove() {
const color = this.turn;
// Stop at the first move found
atLeastOneMove() {
const color = this.turn;
- const oppCol = V.GetOppCol(color);
for (let i = 0; i < V.size.x; i++) {
for (let j = 0; j < V.size.y; j++) {
for (let i = 0; i < V.size.x; i++) {
for (let j = 0; j < V.size.y; j++) {
- if (this.board[i][j] != V.EMPTY && this.getColor(i, j) != oppCol) {
- const moves = this.getPotentialMovesFrom([i, j]);
- if (moves.length > 0)
- return true;
+ if (this.board[i][j] != V.EMPTY && this.getColor(i, j) == color) {
+ if (this.getPotentialMovesFrom([i, j]).length > 0) return true;
}
}
}
}
}
}
@@
-154,8
+152,7
@@
export class BenedictRules extends ChessRules {
const kp = this.kingPos[color];
if (this.getColor(kp[0], kp[1]) != color)
return color == "w" ? "0-1" : "1-0";
const kp = this.kingPos[color];
if (this.getColor(kp[0], kp[1]) != color)
return color == "w" ? "0-1" : "1-0";
- if (this.atLeastOneMove())
- return "*";
+ if (this.atLeastOneMove()) return "*";
// Stalemate:
return "1/2";
}
// Stalemate:
return "1/2";
}
@@
-170,4
+167,5
@@
export class BenedictRules extends ChessRules {
};
return super.getNotation(basicMove);
}
};
return super.getNotation(basicMove);
}
+
};
};