Code reorganization
[vchess.git] / client / src / variants / Antiking.js
similarity index 95%
rename from client/client_OLD/javascripts/variants/Antiking.js
rename to client/src/variants/Antiking.js
index 66eb9f0..890da58 100644 (file)
@@ -150,25 +150,25 @@ class AntikingRules extends ChessRules
                let antikingPos = { "w": -1, "b": -1 };
                for (let c of ["w","b"])
                {
-                       let positions = _.range(8);
+                       let positions = range(8);
 
                        // Get random squares for bishops, but avoid corners; because,
                        // if an antiking blocks a cornered bishop, it can never be checkmated
-                       let randIndex = 2 * _.random(1,3);
+                       let randIndex = 2 * random(1,4);
                        const bishop1Pos = positions[randIndex];
-                       let randIndex_tmp = 2 * _.random(2) + 1;
+                       let randIndex_tmp = 2 * random(3) + 1;
                        const bishop2Pos = positions[randIndex_tmp];
                        positions.splice(Math.max(randIndex,randIndex_tmp), 1);
                        positions.splice(Math.min(randIndex,randIndex_tmp), 1);
 
-                       randIndex = _.random(5);
+                       randIndex = random(6);
                        const knight1Pos = positions[randIndex];
                        positions.splice(randIndex, 1);
-                       randIndex = _.random(4);
+                       randIndex = random(5);
                        const knight2Pos = positions[randIndex];
                        positions.splice(randIndex, 1);
 
-                       randIndex = _.random(3);
+                       randIndex = random(4);
                        const queenPos = positions[randIndex];
                        positions.splice(randIndex, 1);
 
@@ -177,7 +177,7 @@ class AntikingRules extends ChessRules
                        const rook2Pos = positions[2];
 
                        // Random squares for antikings
-                       antikingPos[c] = _.random(7);
+                       antikingPos[c] = random(8);
 
                        pieces[c][rook1Pos] = 'r';
                        pieces[c][knight1Pos] = 'n';