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 1.6.3 to 1.6.4

21

lib/utils.js

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

var thatTurn = exports.getOppositePlayer(getTurn_1.getTurn(game));
var thisPlayersCurrentPosition = game.playerPositions[thisTurn];
var thatPlayersCurrentPosition = game.playerPositions[thatTurn];
var thisPlayersShortestPath = exports.shortestPath(game, thisTurn);

@@ -1153,11 +1155,18 @@ var thatPlayersShortestPath = exports.shortestPath(game, thatTurn);

return false;
if (!overlapsPath(thisPlayersShortestPath, wallMove) &&
!overlapsPath(thatPlayersShortestPath, wallMove)) {
if (
/**
* shortestPath returns a list of moves, so it does not include the
* initial position. We need the initial position here to check if a
* wall blocks the first step of a path. To simplify this, consider
* changing shortestPath to include the initial position in the path.
*/
!overlapsPath(__spreadArray([thisPlayersCurrentPosition], thisPlayersShortestPath), wallMove) &&
!overlapsPath(__spreadArray([thatPlayersCurrentPosition], thatPlayersShortestPath), wallMove)) {
return true;
}
var gameWithUnvalidatedMove = exports.unvalidatedMove(game, wallMove);
var thisTurn = getTurn_1.getTurn(game);
var thatTurn = exports.getOppositePlayer(getTurn_1.getTurn(game));
var thisShortestPath = exports.shortestPath(gameWithUnvalidatedMove, thisTurn);
var thatShortestPath = exports.shortestPath(gameWithUnvalidatedMove, thatTurn);
var thisTurnAfterMove = getTurn_1.getTurn(game);
var thatTurnAfterMove = exports.getOppositePlayer(getTurn_1.getTurn(game));
var thisShortestPath = exports.shortestPath(gameWithUnvalidatedMove, thisTurnAfterMove);
var thatShortestPath = exports.shortestPath(gameWithUnvalidatedMove, thatTurnAfterMove);
return Boolean(thisShortestPath && thatShortestPath);

@@ -1164,0 +1173,0 @@ });

{
"name": "quoridor",
"version": "1.6.3",
"version": "1.6.4",
"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