projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add Knightrelay1. Some fixes. Move odd 'isAttackedBy_multiple_colors' to Checkered...
[vchess.git]
/
client
/
src
/
variants
/
Shatranj.js
diff --git
a/client/src/variants/Shatranj.js
b/client/src/variants/Shatranj.js
index
bb00101
..
969b819
100644
(file)
--- a/
client/src/variants/Shatranj.js
+++ b/
client/src/variants/Shatranj.js
@@
-1,6
+1,3
@@
-// TODO: bishop OK, but queen should move vertical/horizontal and capture diagonally.
-// ==> then the pawn promotion is a real promotion (enhancement).
-
import { ChessRules } from "@/base_rules";
export const VariantRules = class ShatranjRules extends ChessRules {
import { ChessRules } from "@/base_rules";
export const VariantRules = class ShatranjRules extends ChessRules {
@@
-21,8
+18,9
@@
export const VariantRules = class ShatranjRules extends ChessRules {
];
}
];
}
- static GenRandInitFen() {
- return ChessRules.GenRandInitFen().replace("w 1111 -", "w");
+ static GenRandInitFen(randomness) {
+ // Remove castle flags and en-passant indication
+ return ChessRules.GenRandInitFen(randomness).slice(0, -7);
}
getPotentialPawnMoves([x, y]) {
}
getPotentialPawnMoves([x, y]) {
@@
-100,20
+98,20
@@
export const VariantRules = class ShatranjRules extends ChessRules {
);
}
);
}
- isAttackedByBishop(sq, color
s
) {
+ 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"
@@
-159,7
+157,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 :(