Comparing version 1.7.0 to 1.7.1
@@ -10,2 +10,3 @@ "use strict"; | ||
var aStar_1 = require("./aStar"); | ||
var consts_1 = require("./consts"); | ||
var getTurn_1 = require("./getTurn"); | ||
@@ -976,2 +977,5 @@ var makeUnvalidatedMove_1 = require("./makeUnvalidatedMove"); | ||
var overlapsWall = function (game, wallMove) { | ||
var numberOfPlacedWalls = getNumberOfPlacedWalls(game); | ||
if (numberOfPlacedWalls === 0) | ||
return false; | ||
var x = exports.getHorizontalCoordinate(wallMove); | ||
@@ -1206,2 +1210,5 @@ var y = exports.getVerticalCoordinate(wallMove); | ||
}; | ||
var getNumberOfPlacedWalls = function (game) { | ||
return 20 - game.playerWallCounts[1] - game.playerWallCounts[2]; | ||
}; | ||
var getValidWallMoveArray = function (game) { | ||
@@ -1216,5 +1223,8 @@ if (game.playerWallCounts[getTurn_1.getTurn(game)] < 1) { | ||
var allWallMoves = getAllWallMoves().map(function (moveObject) { return exports.moveObjectToMove(moveObject); }); | ||
// The first placed wall can never be invalid, so no need to check for validity | ||
if (game.playerWallCounts[1] === 10 && game.playerWallCounts[2] === 10) { | ||
return allWallMoves; | ||
var numberOfPlacedWalls = getNumberOfPlacedWalls(game); | ||
if (numberOfPlacedWalls <= 2) { | ||
if (!consts_1.possiblyTrappedPositions[(numberOfPlacedWalls + 1)].includes(exports.moveObjectToMove(game.playerPositions[1])) && | ||
!consts_1.possiblyTrappedPositions[(numberOfPlacedWalls + 1)].includes(exports.moveObjectToMove(game.playerPositions[2]))) { | ||
return allWallMoves.filter(function (wallMove) { return !overlapsWall(game, wallMove); }); | ||
} | ||
} | ||
@@ -1221,0 +1231,0 @@ var thisPlayersShortestPath = exports.shortestPath(game, thisTurn); |
{ | ||
"name": "quoridor", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"description": "A JavaScipt Quoridor library for move validation etc.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
124961
51
2733