Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quoridor

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quoridor - npm Package Compare versions

Comparing version 2.6.1 to 2.6.2

203

lib/immutable/utils.js

@@ -701,4 +701,2 @@ "use strict";

return false;
var x = (0, exports.getHorizontalCoordinate)(wallMove);
var y = (0, exports.getVerticalCoordinate)(wallMove);
if ((0, exports.isHorizontalWallMove)(wallMove)) {

@@ -754,164 +752,133 @@ // A horizontal wall

var doesHorizontalWallHaveVerticalWallAboveRight = function (game, wallMove) {
var verticalWallAboveRight = [wallMove]
.filter(isHorizontallyIncrementableWallPosition)
.map(moveWallRight)
.map(rotateWall)
.filter(isVerticallyIncrementableWallPosition)
.map(moveWallUp)[0];
if (!verticalWallAboveRight)
if (!isHorizontallyIncrementableWallPosition(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(verticalWallAboveRight)).concat((0, exports.getVerticalCoordinate)(verticalWallAboveRight)).concat((0, exports.getWallOrientation)(verticalWallAboveRight))];
var wallMovedRightAndRotated = rotateWall(moveWallRight(wallMove));
if (!isVerticallyIncrementableWallPosition(wallMovedRightAndRotated))
return false;
var verticalWallAboveRight = moveWallUp(wallMovedRightAndRotated);
return game.board[verticalWallAboveRight];
};
var doesHorizontalWallHaveVerticalWallAboveLeft = function (game, wallMove) {
var verticalWallAboveLeft = [wallMove]
.filter(exports.isHorizontallyDecrementableWallPosition)
.map(exports.moveWallLeft)
.map(rotateWall)
.filter(isVerticallyIncrementableWallPosition)
.map(moveWallUp)[0];
if (!verticalWallAboveLeft)
if (!(0, exports.isHorizontallyDecrementableWallPosition)(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(verticalWallAboveLeft)).concat((0, exports.getVerticalCoordinate)(verticalWallAboveLeft)).concat((0, exports.getWallOrientation)(verticalWallAboveLeft))];
var wallMovedLeftAndRotated = rotateWall((0, exports.moveWallLeft)(wallMove));
if (!isVerticallyIncrementableWallPosition(wallMovedLeftAndRotated))
return false;
var verticalWallAboveLeft = moveWallUp(wallMovedLeftAndRotated);
return game.board[verticalWallAboveLeft];
};
var doesHorizontalWallHaveVerticalWallBelowRight = function (game, wallMove) {
var verticalWallBelowRight = [wallMove]
.filter(isHorizontallyIncrementableWallPosition)
.map(moveWallRight)
.map(rotateWall)
.filter(exports.isVerticallyDecrementableWallPosition)
.map(exports.moveWallDown)[0];
if (!verticalWallBelowRight)
if (!isHorizontallyIncrementableWallPosition(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(verticalWallBelowRight)).concat((0, exports.getVerticalCoordinate)(verticalWallBelowRight)).concat((0, exports.getWallOrientation)(verticalWallBelowRight))];
var wallMovedRightAndRotated = rotateWall(moveWallRight(wallMove));
if (!(0, exports.isVerticallyDecrementableWallPosition)(wallMovedRightAndRotated))
return false;
var verticalWallBelowRight = (0, exports.moveWallDown)(wallMovedRightAndRotated);
return game.board[verticalWallBelowRight];
};
var doesHorizontalWallHaveVerticalWallBelowLeft = function (game, wallMove) {
var verticalWallBelowLeft = [wallMove]
.filter(exports.isHorizontallyDecrementableWallPosition)
.map(exports.moveWallLeft)
.map(rotateWall)
.filter(exports.isVerticallyDecrementableWallPosition)
.map(exports.moveWallDown)[0];
if (!verticalWallBelowLeft)
if (!(0, exports.isHorizontallyDecrementableWallPosition)(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(verticalWallBelowLeft)).concat((0, exports.getVerticalCoordinate)(verticalWallBelowLeft)).concat((0, exports.getWallOrientation)(verticalWallBelowLeft))];
var wallMovedLeftAndRotated = rotateWall((0, exports.moveWallLeft)(wallMove));
if (!(0, exports.isVerticallyDecrementableWallPosition)(wallMovedLeftAndRotated))
return false;
var verticalWallBelowLeft = (0, exports.moveWallDown)(wallMovedLeftAndRotated);
return game.board[verticalWallBelowLeft];
};
var doesHorizontalWallHaveHorizontalWallRight = function (game, wallMove) {
var horizontalWallRight = [wallMove]
.filter(isHorizontallyIncrementableWallPosition)
.map(moveWallRight)
.filter(isHorizontallyIncrementableWallPosition)
.map(moveWallRight)[0];
if (!horizontalWallRight)
if (!isHorizontallyIncrementableWallPosition(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(horizontalWallRight)).concat((0, exports.getVerticalCoordinate)(horizontalWallRight)).concat((0, exports.getWallOrientation)(horizontalWallRight))];
var wallMovedRight = moveWallRight(wallMove);
if (!isHorizontallyIncrementableWallPosition(wallMovedRight))
return false;
var horizontalWallRight = moveWallRight(wallMovedRight);
return game.board[horizontalWallRight];
};
var doesHorizontalWallHaveHorizontalWallLeft = function (game, wallMove) {
var horizontalWallLeft = [wallMove]
.filter(exports.isHorizontallyDecrementableWallPosition)
.map(exports.moveWallLeft)
.filter(exports.isHorizontallyDecrementableWallPosition)
.map(exports.moveWallLeft)[0];
if (!horizontalWallLeft)
if (!(0, exports.isHorizontallyDecrementableWallPosition)(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(horizontalWallLeft)).concat((0, exports.getVerticalCoordinate)(horizontalWallLeft)).concat((0, exports.getWallOrientation)(horizontalWallLeft))];
var wallMovedLeft = (0, exports.moveWallLeft)(wallMove);
if (!(0, exports.isHorizontallyDecrementableWallPosition)(wallMovedLeft))
return false;
var horizontalWallLeft = (0, exports.moveWallLeft)(wallMovedLeft);
return game.board[horizontalWallLeft];
};
var doesHorizontalWallHaveVerticalWallAbove = function (game, wallMove) {
var verticalWallAbove = [wallMove]
.filter(isVerticallyIncrementableWallPosition)
.map(moveWallUp)
.map(rotateWall)[0];
if (!verticalWallAbove)
if (!isVerticallyIncrementableWallPosition(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(verticalWallAbove)).concat((0, exports.getVerticalCoordinate)(verticalWallAbove)).concat((0, exports.getWallOrientation)(verticalWallAbove))];
var verticalWallAbove = rotateWall(moveWallUp(wallMove));
return game.board[verticalWallAbove];
};
var doesHorizontalWallHaveVerticalWallBelow = function (game, wallMove) {
var verticalWallBelow = [wallMove]
.filter(exports.isVerticallyDecrementableWallPosition)
.map(exports.moveWallDown)
.map(rotateWall)[0];
if (!verticalWallBelow)
if (!(0, exports.isVerticallyDecrementableWallPosition)(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(verticalWallBelow)).concat((0, exports.getVerticalCoordinate)(verticalWallBelow)).concat((0, exports.getWallOrientation)(verticalWallBelow))];
var verticalWallBelow = rotateWall((0, exports.moveWallDown)(wallMove));
return game.board[verticalWallBelow];
};
var doesVerticalWallHaveHorizontalWallAboveRight = function (game, wallMove) {
var horizontalWallAboveRight = [wallMove]
.filter(isHorizontallyIncrementableWallPosition)
.map(moveWallRight)
.map(rotateWall)
.filter(isVerticallyIncrementableWallPosition)
.map(moveWallUp)[0];
if (!horizontalWallAboveRight)
if (!isHorizontallyIncrementableWallPosition(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(horizontalWallAboveRight)).concat((0, exports.getVerticalCoordinate)(horizontalWallAboveRight)).concat((0, exports.getWallOrientation)(horizontalWallAboveRight))];
var wallMovedRightAndRotated = rotateWall(moveWallRight(wallMove));
if (!isVerticallyIncrementableWallPosition(wallMovedRightAndRotated))
return false;
var horizontalWallAboveRight = moveWallUp(wallMovedRightAndRotated);
return game.board[horizontalWallAboveRight];
};
var doesVerticalWallHaveHorizontalWallAboveLeft = function (game, wallMove) {
var horizontalWallAboveLeft = [wallMove]
.filter(exports.isHorizontallyDecrementableWallPosition)
.map(exports.moveWallLeft)
.map(rotateWall)
.filter(isVerticallyIncrementableWallPosition)
.map(moveWallUp)[0];
if (!horizontalWallAboveLeft)
if (!(0, exports.isHorizontallyDecrementableWallPosition)(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(horizontalWallAboveLeft)).concat((0, exports.getVerticalCoordinate)(horizontalWallAboveLeft)).concat((0, exports.getWallOrientation)(horizontalWallAboveLeft))];
var wallMovedLeftAndRotated = rotateWall((0, exports.moveWallLeft)(wallMove));
if (!isVerticallyIncrementableWallPosition(wallMovedLeftAndRotated))
return false;
var horizontalWallAboveLeft = moveWallUp(wallMovedLeftAndRotated);
return game.board[horizontalWallAboveLeft];
};
var doesVerticalWallHaveHorizontalWallBelowRight = function (game, wallMove) {
var horizontalWallBelowRight = [wallMove]
.filter(isHorizontallyIncrementableWallPosition)
.map(moveWallRight)
.map(rotateWall)
.filter(exports.isVerticallyDecrementableWallPosition)
.map(exports.moveWallDown)[0];
if (!horizontalWallBelowRight)
if (!isHorizontallyIncrementableWallPosition(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(horizontalWallBelowRight)).concat((0, exports.getVerticalCoordinate)(horizontalWallBelowRight)).concat((0, exports.getWallOrientation)(horizontalWallBelowRight))];
var wallMovedRightAndRotated = rotateWall(moveWallRight(wallMove));
if (!(0, exports.isVerticallyDecrementableWallPosition)(wallMovedRightAndRotated))
return false;
var horizontalWallBelowRight = (0, exports.moveWallDown)(wallMovedRightAndRotated);
return game.board[horizontalWallBelowRight];
};
var doesVerticalWallHaveHorizontalWallBelowLeft = function (game, wallMove) {
var horizontalWallBelowLeft = [wallMove]
.filter(exports.isHorizontallyDecrementableWallPosition)
.map(exports.moveWallLeft)
.map(rotateWall)
.filter(exports.isVerticallyDecrementableWallPosition)
.map(exports.moveWallDown)[0];
if (!horizontalWallBelowLeft)
if (!(0, exports.isHorizontallyDecrementableWallPosition)(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(horizontalWallBelowLeft)).concat((0, exports.getVerticalCoordinate)(horizontalWallBelowLeft)).concat((0, exports.getWallOrientation)(horizontalWallBelowLeft))];
var wallMovedLeftAndRotated = rotateWall((0, exports.moveWallLeft)(wallMove));
if (!(0, exports.isVerticallyDecrementableWallPosition)(wallMovedLeftAndRotated))
return false;
var horizontalWallBelowLeft = (0, exports.moveWallDown)(wallMovedLeftAndRotated);
return game.board[horizontalWallBelowLeft];
};
var doesVerticalWallHaveVerticalWallAbove = function (game, wallMove) {
var verticalWallAbove = [wallMove]
.filter(isVerticallyIncrementableWallPosition)
.map(moveWallUp)
.filter(isVerticallyIncrementableWallPosition)
.map(moveWallUp)[0];
if (!verticalWallAbove)
if (!isVerticallyIncrementableWallPosition(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(verticalWallAbove)).concat((0, exports.getVerticalCoordinate)(verticalWallAbove)).concat((0, exports.getWallOrientation)(verticalWallAbove))];
var wallMovedUp = moveWallUp(wallMove);
if (!isVerticallyIncrementableWallPosition(wallMovedUp))
return false;
var verticalWallAbove = moveWallUp(wallMovedUp);
return game.board[verticalWallAbove];
};
var doesVerticalWallHaveVerticalWallBelow = function (game, wallMove) {
var verticalWallBelow = [wallMove]
.filter(exports.isVerticallyDecrementableWallPosition)
.map(exports.moveWallDown)
.filter(exports.isVerticallyDecrementableWallPosition)
.map(exports.moveWallDown)[0];
if (!verticalWallBelow)
if (!(0, exports.isVerticallyDecrementableWallPosition)(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(verticalWallBelow)).concat((0, exports.getVerticalCoordinate)(verticalWallBelow)).concat((0, exports.getWallOrientation)(verticalWallBelow))];
// TODO: simplify
var wallMovedDown = (0, exports.moveWallDown)(wallMove);
if (!(0, exports.isVerticallyDecrementableWallPosition)(wallMovedDown))
return false;
var verticalWallBelow = (0, exports.moveWallDown)(wallMovedDown);
return game.board[verticalWallBelow];
};
var doesVerticalWallHaveHorizontalWallAbove = function (game, wallMove) {
var horizontalWallAbove = [wallMove]
.filter(isVerticallyIncrementableWallPosition)
.map(moveWallUp)
.map(rotateWall)[0];
if (!horizontalWallAbove)
if (!isVerticallyIncrementableWallPosition(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(horizontalWallAbove)).concat((0, exports.getVerticalCoordinate)(horizontalWallAbove)).concat((0, exports.getWallOrientation)(horizontalWallAbove))];
var horizontalWallAbove = rotateWall(moveWallUp(wallMove));
return game.board[horizontalWallAbove];
};
var doesVerticalWallHaveHorizontalWallBelow = function (game, wallMove) {
var horizontalWallBelow = [wallMove]
.filter(exports.isVerticallyDecrementableWallPosition)
.map(exports.moveWallDown)
.map(rotateWall)[0];
if (!horizontalWallBelow)
if (!(0, exports.isVerticallyDecrementableWallPosition)(wallMove))
return false;
return game.board["".concat((0, exports.getHorizontalCoordinate)(horizontalWallBelow)).concat((0, exports.getVerticalCoordinate)(horizontalWallBelow)).concat((0, exports.getWallOrientation)(horizontalWallBelow))];
var horizontalWallBelow = rotateWall((0, exports.moveWallDown)(wallMove));
return game.board[horizontalWallBelow];
};

@@ -918,0 +885,0 @@ var doesHorizontalWallHaveBoardEdgeRight = function (wallMove) {

{
"name": "quoridor",
"version": "2.6.1",
"version": "2.6.2",
"description": "A JavaScipt Quoridor library for move validation etc.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc