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.2.0 to 2.2.1

59

lib/utils.js

@@ -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",

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