projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add Colorbound Clobberers (R. Betza)
[vchess.git]
/
client
/
src
/
variants
/
Ball.js
diff --git
a/client/src/variants/Ball.js
b/client/src/variants/Ball.js
index
0f84bae
..
734a921
100644
(file)
--- a/
client/src/variants/Ball.js
+++ b/
client/src/variants/Ball.js
@@
-125,7
+125,7
@@
export class BallRules extends ChessRules {
static GenRandInitFen(randomness) {
if (randomness == 0)
static GenRandInitFen(randomness) {
if (randomness == 0)
- return "
rnbcqcnbr/ppppppppp/9/9/4a4/9/9/PPPPPPPPP/RNBCQCNBR
w 0 -";
+ return "
hbnrqrnhb/ppppppppp/9/9/4a4/9/9/PPPPPPPPP/HBNRQRNHB
w 0 -";
let pieces = { w: new Array(9), b: new Array(9) };
for (let c of ["w", "b"]) {
let pieces = { w: new Array(9), b: new Array(9) };
for (let c of ["w", "b"]) {
@@
-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', 'c', 'c
', '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 (