Comparing version 1.6.4 to 1.6.5
@@ -273,7 +273,10 @@ "use strict"; | ||
var horizontalCoordinate = exports.getHorizontalCoordinate(move); | ||
if (game.wallMatrix[exports.getHorizontalCoordinate(move)][exports.getVerticalCoordinate(move)].h || | ||
(letterToNumber(exports.getHorizontalCoordinate(move)) > | ||
1 && | ||
var verticalCoordinate = exports.getVerticalCoordinate(move); | ||
if ((isHorizontalWallPosition(horizontalCoordinate) && | ||
isVerticalWallPosition(verticalCoordinate) && | ||
game.wallMatrix[horizontalCoordinate][verticalCoordinate].h) || | ||
(letterToNumber(exports.getHorizontalCoordinate(move)) > 1 && | ||
isDecrementableHorizontalPiecePosition(horizontalCoordinate) && | ||
game.wallMatrix[decrementHorizontalPiecePosition(horizontalCoordinate)][exports.getVerticalCoordinate(move)].h)) { | ||
isVerticalWallPosition(verticalCoordinate) && | ||
game.wallMatrix[decrementHorizontalPiecePosition(horizontalCoordinate)][verticalCoordinate].h)) { | ||
return true; | ||
@@ -311,6 +314,12 @@ } | ||
var hasWallToTheRight = function (game, move) { | ||
var horizontalCoordinate = exports.getHorizontalCoordinate(move); | ||
var verticalCoordinate = exports.getVerticalCoordinate(move); | ||
if ((exports.getVerticalCoordinate(move) < 9 && | ||
game.wallMatrix[exports.getHorizontalCoordinate(move)][exports.getVerticalCoordinate(move)].v) || | ||
isHorizontalWallPosition(horizontalCoordinate) && | ||
isVerticalWallPosition(verticalCoordinate) && | ||
game.wallMatrix[horizontalCoordinate][verticalCoordinate].v) || | ||
(exports.getVerticalCoordinate(move) > 1 && | ||
game.wallMatrix[exports.getHorizontalCoordinate(move)][(exports.getVerticalCoordinate(move) - 1)].v)) { | ||
isHorizontalWallPosition(horizontalCoordinate) && | ||
isDecrementableVerticalPiecePosition(verticalCoordinate) && | ||
game.wallMatrix[horizontalCoordinate][decrementVerticalPiecePosition(verticalCoordinate)].v)) { | ||
return true; | ||
@@ -342,8 +351,11 @@ } | ||
var horizontalCoordinate = exports.getHorizontalCoordinate(move); | ||
var verticalCoordinate = exports.getVerticalCoordinate(move); | ||
if ((exports.getVerticalCoordinate(move) < 9 && | ||
isDecrementableHorizontalPiecePosition(horizontalCoordinate) && | ||
game.wallMatrix[decrementHorizontalPiecePosition(horizontalCoordinate)][exports.getVerticalCoordinate(move)].v) || | ||
isVerticalWallPosition(verticalCoordinate) && | ||
game.wallMatrix[decrementHorizontalPiecePosition(horizontalCoordinate)][verticalCoordinate].v) || | ||
(exports.getVerticalCoordinate(move) > 1 && | ||
isDecrementableHorizontalPiecePosition(horizontalCoordinate) && | ||
game.wallMatrix[decrementHorizontalPiecePosition(horizontalCoordinate)][(exports.getVerticalCoordinate(move) - 1)].v)) { | ||
isDecrementableVerticalPiecePosition(verticalCoordinate) && | ||
game.wallMatrix[decrementHorizontalPiecePosition(horizontalCoordinate)][decrementVerticalPiecePosition(verticalCoordinate)].v)) { | ||
return true; | ||
@@ -391,6 +403,10 @@ } | ||
var horizontalCoordinate = exports.getHorizontalCoordinate(move); | ||
if (game.wallMatrix[horizontalCoordinate][(exports.getVerticalCoordinate(move) - 1)].h || | ||
var verticalCoordinate = exports.getVerticalCoordinate(move); | ||
if ((isHorizontalWallPosition(horizontalCoordinate) && | ||
isDecrementableVerticalPiecePosition(verticalCoordinate) && | ||
game.wallMatrix[horizontalCoordinate][decrementVerticalPiecePosition(verticalCoordinate)].h) || | ||
(letterToNumber(exports.getHorizontalCoordinate(move)) > 1 && | ||
isDecrementableHorizontalPiecePosition(horizontalCoordinate) && | ||
game.wallMatrix[decrementHorizontalPiecePosition(horizontalCoordinate)][(exports.getVerticalCoordinate(move) - 1)].h)) { | ||
isDecrementableVerticalPiecePosition(verticalCoordinate) && | ||
game.wallMatrix[decrementHorizontalPiecePosition(horizontalCoordinate)][decrementVerticalPiecePosition(verticalCoordinate)].h)) { | ||
return true; | ||
@@ -968,4 +984,4 @@ } | ||
}; | ||
var isIncrementableHorizontalWallPosition = function (horizontalWallPosition) { | ||
switch (horizontalWallPosition) { | ||
var isHorizontalWallPosition = function (horizontalPosition) { | ||
switch (horizontalPosition) { | ||
case 'a': | ||
@@ -978,2 +994,3 @@ case 'b': | ||
case 'g': | ||
case 'h': | ||
return true; | ||
@@ -984,4 +1001,20 @@ default: | ||
}; | ||
var isDecrementableHorizontalWallPosition = function (horizontalWallPosition) { | ||
switch (horizontalWallPosition) { | ||
var isVerticalWallPosition = function (verticalPosition) { | ||
switch (verticalPosition) { | ||
case 1: | ||
case 2: | ||
case 3: | ||
case 4: | ||
case 5: | ||
case 6: | ||
case 7: | ||
case 8: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
}; | ||
var isIncrementableHorizontalWallPosition = function (horizontalPosition) { | ||
switch (horizontalPosition) { | ||
case 'a': | ||
case 'b': | ||
@@ -993,2 +1026,15 @@ case 'c': | ||
case 'g': | ||
return true; | ||
default: | ||
return false; | ||
} | ||
}; | ||
var isDecrementableHorizontalWallPosition = function (horizontalPosition) { | ||
switch (horizontalPosition) { | ||
case 'b': | ||
case 'c': | ||
case 'd': | ||
case 'e': | ||
case 'f': | ||
case 'g': | ||
case 'h': | ||
@@ -1000,4 +1046,4 @@ return true; | ||
}; | ||
var isIncrementableVerticalWallPosition = function (horizontalWallPosition) { | ||
switch (horizontalWallPosition) { | ||
var isIncrementableVerticalWallPosition = function (horizontalPosition) { | ||
switch (horizontalPosition) { | ||
case 1: | ||
@@ -1015,4 +1061,4 @@ case 2: | ||
}; | ||
var isDecrementableVerticalWallPosition = function (horizontalWallPosition) { | ||
switch (horizontalWallPosition) { | ||
var isDecrementableVerticalWallPosition = function (horizontalPosition) { | ||
switch (horizontalPosition) { | ||
case 2: | ||
@@ -1019,0 +1065,0 @@ case 3: |
{ | ||
"name": "quoridor", | ||
"version": "1.6.4", | ||
"version": "1.6.5", | ||
"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
119761
2555