projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Football
[vchess.git]
/
client
/
src
/
variants
/
Shatranj.js
diff --git
a/client/src/variants/Shatranj.js
b/client/src/variants/Shatranj.js
index
105331f
..
568e2d9
100644
(file)
--- a/
client/src/variants/Shatranj.js
+++ b/
client/src/variants/Shatranj.js
@@
-1,6
+1,7
@@
import { ChessRules } from "@/base_rules";
export class ShatranjRules extends ChessRules {
import { ChessRules } from "@/base_rules";
export class ShatranjRules extends ChessRules {
+
static get HasFlags() {
return false;
}
static get HasFlags() {
return false;
}
@@
-9,6
+10,14
@@
export class ShatranjRules extends ChessRules {
return false;
}
return false;
}
+ static get Monochrome() {
+ return true;
+ }
+
+ static get Notoodark() {
+ return true;
+ }
+
static get PawnSpecs() {
return Object.assign(
{},
static get PawnSpecs() {
return Object.assign(
{},
@@
-20,6
+29,11
@@
export class ShatranjRules extends ChessRules {
);
}
);
}
+ getPpath(b) {
+ if (b[1] == 'b') return "Shatranj/" + b;
+ return b;
+ }
+
static get ElephantSteps() {
return [
[-2, -2],
static get ElephantSteps() {
return [
[-2, -2],
@@
-29,57
+43,40
@@
export class ShatranjRules extends ChessRules {
];
}
];
}
- static GenRandInitFen(
randomnes
s) {
+ static GenRandInitFen(
option
s) {
// Remove castle flags and en-passant indication
// Remove castle flags and en-passant indication
- return ChessRules.GenRandInitFen(
randomnes
s).slice(0, -7);
+ return ChessRules.GenRandInitFen(
option
s).slice(0, -7);
}
getPotentialBishopMoves(sq) {
}
getPotentialBishopMoves(sq) {
- let moves = this.getSlideNJumpMoves(sq, V.ElephantSteps,
"oneStep"
);
+ let moves = this.getSlideNJumpMoves(sq, V.ElephantSteps,
1
);
// Complete with "repositioning moves": like a queen, without capture
// Complete with "repositioning moves": like a queen, without capture
- let repositioningMoves = this.getSlideNJumpMoves(
- sq,
- V.steps[V.BISHOP],
- "oneStep"
- ).filter(m => m.vanish.length == 1);
+ let repositioningMoves =
+ this.getSlideNJumpMoves(sq, V.steps[V.BISHOP], 1)
+ .filter(m => m.vanish.length == 1);
return moves.concat(repositioningMoves);
}
getPotentialQueenMoves(sq) {
// Diagonal capturing moves
return moves.concat(repositioningMoves);
}
getPotentialQueenMoves(sq) {
// Diagonal capturing moves
- let captures = this.getSlideNJumpMoves(
- sq,
- V.steps[V.BISHOP],
- "oneStep"
- ).filter(m => m.vanish.length == 2);
+ let captures =
+ this.getSlideNJumpMoves(sq, V.steps[V.BISHOP], 1)
+ .filter(m => m.vanish.length == 2);
return captures.concat(
// Orthogonal non-capturing moves
return captures.concat(
// Orthogonal non-capturing moves
- this.getSlideNJumpMoves(
- sq,
- V.steps[V.ROOK],
- "oneStep"
- ).filter(m => m.vanish.length == 1)
+ this.getSlideNJumpMoves(sq, V.steps[V.ROOK], 1)
+ .filter(m => m.vanish.length == 1)
);
}
isAttackedByBishop(sq, color) {
return this.isAttackedBySlideNJump(
);
}
isAttackedByBishop(sq, color) {
return this.isAttackedBySlideNJump(
- sq,
- color,
- V.BISHOP,
- V.ElephantSteps,
- "oneStep"
- );
+ sq, color, V.BISHOP, V.ElephantSteps, 1);
}
isAttackedByQueen(sq, color) {
return this.isAttackedBySlideNJump(
}
isAttackedByQueen(sq, color) {
return this.isAttackedBySlideNJump(
- sq,
- color,
- V.QUEEN,
- V.steps[V.BISHOP],
- "oneStep"
- );
+ sq, color, V.QUEEN, V.steps[V.BISHOP], 1);
}
getCurrentScore() {
}
getCurrentScore() {
@@
-138,4
+135,5
@@
export class ShatranjRules extends ChessRules {
k: 1000
};
}
k: 1000
};
}
+
};
};