projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Parachute, allow 3 squares in Ball variant
[vchess.git]
/
client
/
src
/
variants
/
Ball.js
diff --git
a/client/src/variants/Ball.js
b/client/src/variants/Ball.js
index
19b81ed
..
3903e2b
100644
(file)
--- a/
client/src/variants/Ball.js
+++ b/
client/src/variants/Ball.js
@@
-134,17
+134,26
@@
export class BallRules extends ChessRules {
break;
}
break;
}
- // Get random squares for every piece, totally freely
+ // Get random squares for every piece, with bishops and phoenixes
+ // on different colors:
let positions = shuffle(ArrayFun.range(9));
let positions = shuffle(ArrayFun.range(9));
- const composition = ['b', 'b', '
r', 'r', 'n', 'n', 'h', 'h
', 'q'];
-
cons
t rem2 = positions[0] % 2;
+ const composition = ['b', 'b', '
h', 'h', 'n', 'n', 'r', 'r
', 'q'];
+
le
t rem2 = positions[0] % 2;
if (rem2 == positions[1] % 2) {
// Fix bishops (on different colors)
if (rem2 == positions[1] % 2) {
// Fix bishops (on different colors)
- for (let i=
2
; i<9; i++) {
+ for (let i=
4
; i<9; i++) {
if (positions[i] % 2 != rem2)
[positions[1], positions[i]] = [positions[i], positions[1]];
}
}
if (positions[i] % 2 != rem2)
[positions[1], positions[i]] = [positions[i], positions[1]];
}
}
+ rem2 = positions[2] % 2;
+ if (rem2 == positions[3] % 2) {
+ // Fix phoenixes too:
+ for (let i=4; i<9; i++) {
+ if (positions[i] % 2 != rem2)
+ [positions[3], positions[i]] = [positions[i], positions[3]];
+ }
+ }
for (let i = 0; i < 9; i++) pieces[c][positions[i]] = composition[i];
}
return (
for (let i = 0; i < 9; i++) pieces[c][positions[i]] = composition[i];
}
return (
@@
-259,7
+268,7
@@
export class BallRules extends ChessRules {
return super.getPotentialMovesFrom([x, y]);
}
return super.getPotentialMovesFrom([x, y]);
}
- // "Sliders": at most
2
steps
+ // "Sliders": at most
3
steps
getSlideNJumpMoves([x, y], steps, oneStep) {
let moves = [];
outerLoop: for (let step of steps) {
getSlideNJumpMoves([x, y], steps, oneStep) {
let moves = [];
outerLoop: for (let step of steps) {
@@
-268,7
+277,7
@@
export class BallRules extends ChessRules {
let stepCount = 1;
while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) {
moves.push(this.getBasicMove([x, y], [i, j]));
let stepCount = 1;
while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) {
moves.push(this.getBasicMove([x, y], [i, j]));
- if (oneStep || stepCount ==
2
) continue outerLoop;
+ if (oneStep || stepCount ==
3
) continue outerLoop;
i += step[0];
j += step[1];
stepCount++;
i += step[0];
j += step[1];
stepCount++;