projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More consistent Chakart
[vchess.git]
/
client
/
src
/
variants
/
Makruk.js
diff --git
a/client/src/variants/Makruk.js
b/client/src/variants/Makruk.js
index
5561702
..
b721273
100644
(file)
--- a/
client/src/variants/Makruk.js
+++ b/
client/src/variants/Makruk.js
@@
-36,13
+36,13
@@
export class MakrukRules extends ChessRules {
return 'f';
}
return 'f';
}
- static GenRandInitFen(
randomnes
s) {
- if (randomness == 0)
+ static GenRandInitFen(
option
s) {
+ if (
options.
randomness == 0)
return "rnbqkbnr/8/pppppppp/8/8/PPPPPPPP/8/RNBKQBNR w 0";
let pieces = { w: new Array(8), b: new Array(8) };
for (let c of ["w", "b"]) {
return "rnbqkbnr/8/pppppppp/8/8/PPPPPPPP/8/RNBKQBNR w 0";
let pieces = { w: new Array(8), b: new Array(8) };
for (let c of ["w", "b"]) {
- if (c == 'b' && randomness == 1) {
+ if (c == 'b' &&
options.
randomness == 1) {
pieces['b'] = pieces['w'];
break;
}
pieces['b'] = pieces['w'];
break;
}
@@
-95,39
+95,33
@@
export class MakrukRules extends ChessRules {
getPotentialBishopMoves(sq) {
const forward = (this.turn == 'w' ? -1 : 1);
return this.getSlideNJumpMoves(
getPotentialBishopMoves(sq) {
const forward = (this.turn == 'w' ? -1 : 1);
return this.getSlideNJumpMoves(
- sq,
- V.steps[V.BISHOP].concat([ [forward, 0] ]),
- "oneStep"
- );
+ sq, V.steps[V.BISHOP].concat([ [forward, 0] ]), 1);
}
getPotentialQueenMoves(sq) {
}
getPotentialQueenMoves(sq) {
- return this.getSlideNJumpMoves(
- sq,
- V.steps[V.BISHOP],
- "oneStep"
+ return this.getSlideNJumpMoves(sq, V.steps[V.BISHOP], 1);
+ }
+
+ isAttacked(sq, color) {
+ return (
+ super.isAttacked(sq, color) || this.isAttackedByPromoted(sq, color)
);
}
isAttackedByBishop(sq, color) {
const forward = (color == 'w' ? 1 : -1);
return this.isAttackedBySlideNJump(
);
}
isAttackedByBishop(sq, color) {
const forward = (color == 'w' ? 1 : -1);
return this.isAttackedBySlideNJump(
- sq,
- color,
- V.BISHOP,
- V.steps[V.BISHOP].concat([ [forward, 0] ]),
- "oneStep"
- );
+ sq, color, V.BISHOP, V.steps[V.BISHOP].concat([ [forward, 0] ]), 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);
+ }
+
+ isAttackedByPromoted(sq, color) {
+ return super.isAttackedBySlideNJump(
+
sq, color, V.PROMOTED, V.steps[V.BISHOP], 1
);
}
static get VALUES() {
}
static get VALUES() {