Comparing version 2.2.0 to 2.2.1
@@ -98,8 +98,4 @@ "use strict"; | ||
var isSingleUpMove = function (currentPosition, move) { | ||
if (exports.getVerticalCoordinate(currentPosition) - exports.getVerticalCoordinate(move) === | ||
-1 && | ||
exports.getHorizontalCoordinate(currentPosition) === exports.getHorizontalCoordinate(move)) { | ||
return true; | ||
} | ||
return false; | ||
return (exports.isVerticallyIncrementablePawnPosition(currentPosition) && | ||
exports.verticallyIncrementPawnPosition(currentPosition) === move); | ||
}; | ||
@@ -112,5 +108,4 @@ var hasWallAbove = function (game, move) { | ||
game.board["" + horizontalCoordinate + verticalCoordinate + "h"]) || | ||
(isDecrementableHorizontalPiecePosition(horizontalCoordinate) && | ||
exports.isVerticalWallCoordinate(verticalCoordinate) && | ||
game.board["" + decrementHorizontalPiecePosition(horizontalCoordinate) + verticalCoordinate + "h"])) { | ||
(exports.isHorizontallyDecrementablePawnPosition(move) && | ||
game.board[exports.horizontallyDecrementPawnPosition(move) + "h"])) { | ||
return true; | ||
@@ -121,39 +116,25 @@ } | ||
var isDoubleUpMove = function (currentPosition, move) { | ||
// TODO: Surely this must be wrong, or? | ||
if (exports.getVerticalCoordinate(move) - exports.getVerticalCoordinate(currentPosition) === | ||
2 && | ||
exports.getHorizontalCoordinate(move) === exports.getHorizontalCoordinate(currentPosition)) { | ||
return true; | ||
} | ||
return false; | ||
return ([currentPosition] | ||
.filter(exports.isVerticallyIncrementablePawnPosition) | ||
.map(exports.verticallyIncrementPawnPosition) | ||
.filter(exports.isVerticallyIncrementablePawnPosition) | ||
.map(exports.verticallyIncrementPawnPosition)[0] === move); | ||
}; | ||
var hasOpponentAbove = function (game, position) { | ||
if (exports.isVerticallyIncrementablePawnPosition(position) && | ||
return (exports.isVerticallyIncrementablePawnPosition(position) && | ||
game.board[exports.verticallyIncrementPawnPosition(position)] === | ||
exports.getOppositePlayer(getTurn_1.getTurn(game))) { | ||
return true; | ||
} | ||
return false; | ||
exports.getOppositePlayer(getTurn_1.getTurn(game))); | ||
}; | ||
var isUpLeftMove = function (currentPosition, move) { | ||
if (exports.getVerticalCoordinate(move) - exports.getVerticalCoordinate(currentPosition) === | ||
1 && | ||
letterToNumber(exports.getHorizontalCoordinate(move)) - | ||
letterToNumber(exports.getHorizontalCoordinate(currentPosition)) === | ||
-1) { | ||
return true; | ||
} | ||
return false; | ||
return ([currentPosition] | ||
.filter(exports.isVerticallyIncrementablePawnPosition) | ||
.map(exports.verticallyIncrementPawnPosition) | ||
.filter(exports.isHorizontallyDecrementablePawnPosition) | ||
.map(exports.horizontallyDecrementPawnPosition)[0] === move); | ||
}; | ||
var hasWallToTheRight = function (game, move) { | ||
var horizontalCoordinate = exports.getHorizontalCoordinate(move); | ||
var verticalCoordinate = exports.getVerticalCoordinate(move); | ||
if ((exports.getVerticalCoordinate(move) < 9 && | ||
exports.isHorizontalWallCoordinate(horizontalCoordinate) && | ||
exports.isVerticalWallCoordinate(verticalCoordinate) && | ||
game.board["" + horizontalCoordinate + verticalCoordinate + "v"]) || | ||
(exports.getVerticalCoordinate(move) > 1 && | ||
exports.isHorizontalWallCoordinate(horizontalCoordinate) && | ||
isDecrementableVerticalPiecePosition(verticalCoordinate) && | ||
game.board["" + horizontalCoordinate + decrementVerticalPiecePosition(verticalCoordinate) + "v"])) { | ||
var maybeWallPosition = move + "v"; | ||
if ((exports.isWallPosition(maybeWallPosition) && game.board[maybeWallPosition]) || | ||
(exports.isVerticallyDecrementablePawnPosition(move) && | ||
game.board[exports.verticallyDecrementPawnPosition(move) + "v"])) { | ||
return true; | ||
@@ -160,0 +141,0 @@ } |
{ | ||
"name": "quoridor", | ||
"version": "2.2.0", | ||
"version": "2.2.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
201240
5331