projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Hawk and Elephant movements in S-chess
[vchess.git]
/
client
/
src
/
variants
/
Schess.js
diff --git
a/client/src/variants/Schess.js
b/client/src/variants/Schess.js
index
7cbb47a
..
ebc2c7c
100644
(file)
--- a/
client/src/variants/Schess.js
+++ b/
client/src/variants/Schess.js
@@
-199,16
+199,14
@@
export class SchessRules extends ChessRules {
}
getPotentialHawkMoves(sq) {
}
getPotentialHawkMoves(sq) {
- return this.getSlideNJumpMoves(
- sq,
- V.steps[V.BISHOP].concat(V.steps[V.KNIGHT])
+ return this.getSlideNJumpMoves(sq, V.steps[V.BISHOP]).concat(
+ this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], "oneStep")
);
}
getPotentialElephantMoves(sq) {
);
}
getPotentialElephantMoves(sq) {
- return this.getSlideNJumpMoves(
- sq,
- V.steps[V.ROOK].concat(V.steps[V.KNIGHT])
+ return this.getSlideNJumpMoves(sq, V.steps[V.ROOK]).concat(
+ this.getSlideNJumpMoves(sq, V.steps[V.KNIGHT], "oneStep")
);
}
);
}
@@
-221,20
+219,28
@@
export class SchessRules extends ChessRules {
}
isAttackedByHawk(sq, color) {
}
isAttackedByHawk(sq, color) {
- return this.isAttackedBySlideNJump(
- sq,
- color,
- V.HAWK,
- V.steps[V.BISHOP].concat(V.steps[V.KNIGHT])
+ return (
+ this.isAttackedBySlideNJump(sq, color, V.HAWK, V.steps[V.BISHOP]) ||
+ this.isAttackedBySlideNJump(
+ sq,
+ color,
+ V.HAWK,
+ V.steps[V.KNIGHT],
+ "oneStep"
+ )
);
}
isAttackedByElephant(sq, color) {
);
}
isAttackedByElephant(sq, color) {
- return this.isAttackedBySlideNJump(
- sq,
- color,
- V.ELEPHANT,
- V.steps[V.ROOK].concat(V.steps[V.KNIGHT])
+ return (
+ this.isAttackedBySlideNJump(sq, color, V.ELEPHANT, V.steps[V.ROOK]) ||
+ this.isAttackedBySlideNJump(
+ sq,
+ color,
+ V.ELEPHANT,
+ V.steps[V.KNIGHT],
+ "oneStep"
+ )
);
}
);
}