projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add Knightmate2: two kings, as in Spartan Chess
[vchess.git]
/
client
/
src
/
variants
/
Balaklava.js
diff --git
a/client/src/variants/Balaklava.js
b/client/src/variants/Balaklava.js
index
3a04e1d
..
835aa96
100644
(file)
--- a/
client/src/variants/Balaklava.js
+++ b/
client/src/variants/Balaklava.js
@@
-1,6
+1,7
@@
import { ChessRules } from "@/base_rules";
export class BalaklavaRules extends ChessRules {
import { ChessRules } from "@/base_rules";
export class BalaklavaRules extends ChessRules {
+
static get PawnSpecs() {
return Object.assign(
{},
static get PawnSpecs() {
return Object.assign(
{},
@@
-61,8
+62,19
@@
export class BalaklavaRules extends ChessRules {
: super.getPotentialMovesFrom([x, y]);
if (piece != V.KING) {
// Add non-capturing knight movements
: super.getPotentialMovesFrom([x, y]);
if (piece != V.KING) {
// Add non-capturing knight movements
- const lastRank = (this.turn == 'w' ? 0 : 7);
+ const color = this.turn;
+ const lastRank = (color == 'w' ? 0 : 7);
V.steps[V.KNIGHT].forEach(step => {
V.steps[V.KNIGHT].forEach(step => {
+ // Pawns cannot go backward:
+ if (
+ piece == V.PAWN &&
+ (
+ (color == 'w' && step[0] > 0) ||
+ (color == 'b' && step[0] < 0)
+ )
+ ) {
+ return;
+ }
const [i, j] = [x + step[0], y + step[1]];
if (
V.OnBoard(i, j) &&
const [i, j] = [x + step[0], y + step[1]];
if (
V.OnBoard(i, j) &&
@@
-106,4
+118,5
@@
export class BalaklavaRules extends ChessRules {
ChessRules.VALUES
);
}
ChessRules.VALUES
);
}
+
};
};