From 0fbe4ffafd65f35ad939134cc89b8bafcc4cd5ca Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Sat, 27 Jun 2020 08:53:55 +0200
Subject: [PATCH] Fix Monochrome update

---
 client/src/variants/Monochrome.js | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/client/src/variants/Monochrome.js b/client/src/variants/Monochrome.js
index 8c74961b..919e7703 100644
--- a/client/src/variants/Monochrome.js
+++ b/client/src/variants/Monochrome.js
@@ -60,8 +60,8 @@ export class MonochromeRules extends ChessRules {
   getPotentialKingMoves(sq) {
     // King become queen:
     return (
-      this.getSlideNJumpMoves(sq, V.steps[V.ROOK].concat(V.steps[V.BISHOP]));
-    )
+      this.getSlideNJumpMoves(sq, V.steps[V.ROOK].concat(V.steps[V.BISHOP]))
+    );
   }
 
   getAllPotentialMoves() {
@@ -153,12 +153,16 @@ export class MonochromeRules extends ChessRules {
 
   static GenRandInitFen(randomness) {
     // Remove the en-passant + castle part of the FEN
-    const fen = ChessRules.GenRandInitFen(randomness).slice(0, -6);
+    let fen = ChessRules.GenRandInitFen(randomness).slice(0, -6);
+    // Move pawns up:
+    fen = fen.replace("pppppppp/8","8/pppppppp")
+             .replace("8/PPPPPPPP","PPPPPPPP/8");
     const firstSpace = fen.indexOf(' ');
-    return (
+    // Paint it black:
+    fen =
       fen.substr(0, firstSpace).replace(/[A-Z]/g, (c) => c.toLowerCase()) +
-      fen.substr(firstSpace)
-    );
+      fen.substr(firstSpace);
+    return fen;
   }
 
   static get SEARCH_DEPTH() {
-- 
2.44.0