projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Experimental symmetric randomness + deterministic option
[vchess.git]
/
client
/
src
/
variants
/
Losers.js
diff --git
a/client/src/variants/Losers.js
b/client/src/variants/Losers.js
index
81d2730
..
b4385ba
100644
(file)
--- a/
client/src/variants/Losers.js
+++ b/
client/src/variants/Losers.js
@@
-142,10
+142,19
@@
export const VariantRules = class LosersRules extends ChessRules {
return -super.evalPosition(); //better with less material
}
return -super.evalPosition(); //better with less material
}
- static GenRandInitFen() {
+ static GenRandInitFen(randomness) {
+ if (!randomness) randomness = 2;
+ if (randomness == 0)
+ return "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w 0 -";
+
let pieces = { w: new Array(8), b: new Array(8) };
// Shuffle pieces on first and last rank
for (let c of ["w", "b"]) {
let pieces = { w: new Array(8), b: new Array(8) };
// Shuffle pieces on first and last rank
for (let c of ["w", "b"]) {
+ if (c == 'b' && randomness == 1) {
+ pieces['b'] = pieces['w'];
+ break;
+ }
+
let positions = ArrayFun.range(8);
// Get random squares for bishops
let positions = ArrayFun.range(8);
// Get random squares for bishops
@@
-194,7
+203,8
@@
export const VariantRules = class LosersRules extends ChessRules {
pieces["b"].join("") +
"/pppppppp/8/8/8/8/PPPPPPPP/" +
pieces["w"].join("").toUpperCase() +
pieces["b"].join("") +
"/pppppppp/8/8/8/8/PPPPPPPP/" +
pieces["w"].join("").toUpperCase() +
+ // En-passant allowed, but no flags
" w 0 -"
" w 0 -"
- );
//en-passant allowed, but no flags
+ );
}
};
}
};