projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add Antiking v1
[vchess.git]
/
client
/
src
/
variants
/
Shatranj.js
diff --git
a/client/src/variants/Shatranj.js
b/client/src/variants/Shatranj.js
index
b45d915
..
45a34c0
100644
(file)
--- a/
client/src/variants/Shatranj.js
+++ b/
client/src/variants/Shatranj.js
@@
-5,6
+5,10
@@
export const VariantRules = class ShatranjRules extends ChessRules {
return false;
}
return false;
}
+ static get HasCastle() {
+ return false;
+ }
+
static get HasEnpassant() {
return false;
}
static get HasEnpassant() {
return false;
}
@@
-19,7
+23,8
@@
export const VariantRules = class ShatranjRules extends ChessRules {
}
static GenRandInitFen(randomness) {
}
static GenRandInitFen(randomness) {
- return ChessRules.GenRandInitFen(randomness).replace("w 1111 -", "w");
+ // Remove castle flags and en-passant indication
+ return ChessRules.GenRandInitFen(randomness).slice(0, -7);
}
getPotentialPawnMoves([x, y]) {
}
getPotentialPawnMoves([x, y]) {
@@
-89,28
+94,20
@@
export const VariantRules = class ShatranjRules extends ChessRules {
);
}
);
}
- getPotentialKingMoves(sq) {
- return this.getSlideNJumpMoves(
- sq,
- V.steps[V.ROOK].concat(V.steps[V.BISHOP]),
- "oneStep"
- );
- }
-
- isAttackedByBishop(sq, colors) {
+ isAttackedByBishop(sq, color) {
return this.isAttackedBySlideNJump(
sq,
return this.isAttackedBySlideNJump(
sq,
- color
s
,
+ color,
V.BISHOP,
V.ElephantSteps,
"oneStep"
);
}
V.BISHOP,
V.ElephantSteps,
"oneStep"
);
}
- isAttackedByQueen(sq, color
s
) {
+ isAttackedByQueen(sq, color) {
return this.isAttackedBySlideNJump(
sq,
return this.isAttackedBySlideNJump(
sq,
- color
s
,
+ color,
V.QUEEN,
V.steps[V.BISHOP],
"oneStep"
V.QUEEN,
V.steps[V.BISHOP],
"oneStep"
@@
-156,7
+153,7
@@
export const VariantRules = class ShatranjRules extends ChessRules {
// 2 enemy units or more: I lose
return getScoreLost();
// I don't have any piece, my opponent have one: can I take it?
// 2 enemy units or more: I lose
return getScoreLost();
// I don't have any piece, my opponent have one: can I take it?
- if (this.isAttacked(piecesLeft[oppCol].square,
[color]
))
+ if (this.isAttacked(piecesLeft[oppCol].square,
color
))
// Yes! But I still need to take it
return "*";
// No :(
// Yes! But I still need to take it
return "*";
// No :(