projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Berolina en passant
[vchess.git]
/
client
/
src
/
base_rules.js
diff --git
a/client/src/base_rules.js
b/client/src/base_rules.js
index
5b335b0
..
d2b8a7f
100644
(file)
--- a/
client/src/base_rules.js
+++ b/
client/src/base_rules.js
@@
-238,11
+238,20
@@
export const ChessRules = class ChessRules {
/////////////
// FEN UTILS
/////////////
// FEN UTILS
- // Setup the initial random (assymetric) position
- static GenRandInitFen() {
+ // Setup the initial random (asymmetric) position
+ static GenRandInitFen(randomness) {
+ if (randomness == 0)
+ // Deterministic:
+ return "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w 0 1111 -";
+
let pieces = { w: new Array(8), b: new Array(8) };
let pieces = { w: new Array(8), b: new Array(8) };
- // Shuffle pieces on first
and last rank
+ // Shuffle pieces on first
(and last rank if randomness == 2)
for (let c of ["w", "b"]) {
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