projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add 'Connect' variant
[vchess.git]
/
client
/
src
/
variants
/
Knightpawns.js
diff --git
a/client/src/variants/Knightpawns.js
b/client/src/variants/Knightpawns.js
index
6b7415c
..
c8c1cea
100644
(file)
--- a/
client/src/variants/Knightpawns.js
+++ b/
client/src/variants/Knightpawns.js
@@
-1,6
+1,7
@@
import { ChessRules } from "@/base_rules";
export class KnightpawnsRules extends ChessRules {
import { ChessRules } from "@/base_rules";
export class KnightpawnsRules extends ChessRules {
+
static get PawnSpecs() {
return Object.assign(
{},
static get PawnSpecs() {
return Object.assign(
{},
@@
-34,14
+35,19
@@
export class KnightpawnsRules extends ChessRules {
if (this.board.every(b => b.every(cell => !cell || cell[0] != c)))
return (c == 'w' ? "0-1" : "1-0");
}
if (this.board.every(b => b.every(cell => !cell || cell[0] != c)))
return (c == 'w' ? "0-1" : "1-0");
}
- // Did a black pawn promote? Can the
rook
take it?
+ // Did a black pawn promote? Can the
knight
take it?
const qIdx = this.board[7].findIndex(cell => cell[1] == V.QUEEN);
const qIdx = this.board[7].findIndex(cell => cell[1] == V.QUEEN);
- if (qIdx >= 0 && !super.isAttackedByKnight([7, qIdx], 'w'))
+ if (
+ qIdx >= 0 &&
+ (this.turn == 'b' || !super.isAttackedByKnight([7, qIdx], 'w'))
+ ) {
return "0-1";
return "0-1";
+ }
if (!this.atLeastOneMove()) return "1/2";
return "*";
}
postPlay() {}
postUndo() {}
if (!this.atLeastOneMove()) return "1/2";
return "*";
}
postPlay() {}
postUndo() {}
+
};
};