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.1 to 2.3.0

lib/mirrorHashHorizontally.d.ts

1

lib/consts.d.ts

@@ -5,2 +5,3 @@ import { DecrementableHorizontalPiecePosition, DecrementableHorizontalWallCoordinate, DecrementableVerticalPiecePosition, DecrementableVerticalWallCoordinate, HorizontallyDecrementablePawnPosition, HorizontallyIncrementablePawnPosition, HorizontalPiecePosition, HorizontalWallCoordinate, IncrementableHorizontalPiecePosition, IncrementableHorizontalWallCoordinate, IncrementableVerticalPiecePosition, IncrementableVerticalWallCoordinate, PawnPosition, PlayerMatrix, VerticallyDecrementablePawnPosition, VerticallyIncrementablePawnPosition, VerticalPiecePosition, VerticalWallCoordinate, WallMatrix, WallPosition } from './types';

export declare const positions: (PawnPosition | WallPosition)[];
export declare const horizontallyMirroredPositionsMap: Record<PawnPosition, PawnPosition> & Record<WallPosition, WallPosition>;
export declare const isWallPositionMap: Record<string, true | undefined>;

@@ -7,0 +8,0 @@ export declare const pawnAndWallPositions: (PawnPosition | WallPosition)[];

@@ -19,3 +19,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.isHorizontallyDecrementablePawnPositionMap = exports.horizontallyDecrementedPawnPositions = exports.isHorizontallyIncrementablePawnPositionMap = exports.horizontallyIncrementedPawnPositions = exports.isVerticallyDecrementablePawnPositionMap = exports.verticallyDecrementedPawnPositions = exports.isVerticallyIncrementablePawnPositionMap = exports.verticallyIncrementedPawnPositions = exports.isDecrementableVerticalPiecePositionMap = exports.isIncrementableVerticalPiecePositionMap = exports.isDecrementableHorizontalPiecePositionMap = exports.isIncrementableHorizontalPiecePositionMap = exports.isDecrementableVerticalWallCoordinateMap = exports.isIncrementableVerticalWallCoordinateMap = exports.isDecrementableHorizontalWallCoordinateMap = exports.isIncrementableHorizontalWallCoordinateMap = exports.isVerticalWallCoordinateMap = exports.isHorizontalWallCoordinateMap = exports.incrementedHorizontalPiecePositions = exports.incrementedVerticalPiecePositions = exports.decrementedVerticalPiecePositions = exports.decrementedHorizontalPiecePositions = exports.incrementedVerticalWallCoordinates = exports.decrementedVerticalWallCoordinates = exports.incrementedHorizontalWallCoordinates = exports.decrementedHorizontalWallCoordinates = exports.verticalPiecePositions = exports.verticallyDecrementableWallPositions = exports.verticallyIncrementableWallPositions = exports.horizontallyDecrementableWallPositions = exports.horizontallyIncrementableWallPositions = exports.possiblyTrappedPositions = exports.horizontalPawnCoordinates = exports.initialBoard = exports.pawnAndWallPositions = exports.isWallPositionMap = exports.positions = exports.wallPositions = exports.pawnPositions = void 0;
exports.isHorizontallyDecrementablePawnPositionMap = exports.horizontallyDecrementedPawnPositions = exports.isHorizontallyIncrementablePawnPositionMap = exports.horizontallyIncrementedPawnPositions = exports.isVerticallyDecrementablePawnPositionMap = exports.verticallyDecrementedPawnPositions = exports.isVerticallyIncrementablePawnPositionMap = exports.verticallyIncrementedPawnPositions = exports.isDecrementableVerticalPiecePositionMap = exports.isIncrementableVerticalPiecePositionMap = exports.isDecrementableHorizontalPiecePositionMap = exports.isIncrementableHorizontalPiecePositionMap = exports.isDecrementableVerticalWallCoordinateMap = exports.isIncrementableVerticalWallCoordinateMap = exports.isDecrementableHorizontalWallCoordinateMap = exports.isIncrementableHorizontalWallCoordinateMap = exports.isVerticalWallCoordinateMap = exports.isHorizontalWallCoordinateMap = exports.incrementedHorizontalPiecePositions = exports.incrementedVerticalPiecePositions = exports.decrementedVerticalPiecePositions = exports.decrementedHorizontalPiecePositions = exports.incrementedVerticalWallCoordinates = exports.decrementedVerticalWallCoordinates = exports.incrementedHorizontalWallCoordinates = exports.decrementedHorizontalWallCoordinates = exports.verticalPiecePositions = exports.verticallyDecrementableWallPositions = exports.verticallyIncrementableWallPositions = exports.horizontallyDecrementableWallPositions = exports.horizontallyIncrementableWallPositions = exports.possiblyTrappedPositions = exports.horizontalPawnCoordinates = exports.initialBoard = exports.pawnAndWallPositions = exports.isWallPositionMap = exports.horizontallyMirroredPositionsMap = exports.positions = exports.wallPositions = exports.pawnPositions = void 0;
exports.pawnPositions = [

@@ -235,2 +235,213 @@ 'a1',

exports.positions = __spreadArray(__spreadArray([], exports.pawnPositions), exports.wallPositions);
exports.horizontallyMirroredPositionsMap = {
a1: 'i1',
a2: 'i2',
a3: 'i3',
a4: 'i4',
a5: 'i5',
a6: 'i6',
a7: 'i7',
a8: 'i8',
a9: 'i9',
b1: 'h1',
b2: 'h2',
b3: 'h3',
b4: 'h4',
b5: 'h5',
b6: 'h6',
b7: 'h7',
b8: 'h8',
b9: 'h9',
c1: 'g1',
c2: 'g2',
c3: 'g3',
c4: 'g4',
c5: 'g5',
c6: 'g6',
c7: 'g7',
c8: 'g8',
c9: 'g9',
d1: 'f1',
d2: 'f2',
d3: 'f3',
d4: 'f4',
d5: 'f5',
d6: 'f6',
d7: 'f7',
d8: 'f8',
d9: 'f9',
e1: 'e1',
e2: 'e2',
e3: 'e3',
e4: 'e4',
e5: 'e5',
e6: 'e6',
e7: 'e7',
e8: 'e8',
e9: 'e9',
f1: 'd1',
f2: 'd2',
f3: 'd3',
f4: 'd4',
f5: 'd5',
f6: 'd6',
f7: 'd7',
f8: 'd8',
f9: 'd9',
g1: 'c1',
g2: 'c2',
g3: 'c3',
g4: 'c4',
g5: 'c5',
g6: 'c6',
g7: 'c7',
g8: 'c8',
g9: 'c9',
h1: 'b1',
h2: 'b2',
h3: 'b3',
h4: 'b4',
h5: 'b5',
h6: 'b6',
h7: 'b7',
h8: 'b8',
h9: 'b9',
i1: 'a1',
i2: 'a2',
i3: 'a3',
i4: 'a4',
i5: 'a5',
i6: 'a6',
i7: 'a7',
i8: 'a8',
i9: 'a9',
a1h: 'h1h',
a1v: 'h1v',
a2h: 'h2h',
a2v: 'h2v',
a3h: 'h3h',
a3v: 'h3v',
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2v: 'b2v',
g3h: 'b3h',
g3v: 'b3v',
g4h: 'b4h',
g4v: 'b4v',
g5h: 'b5h',
g5v: 'b5v',
g6h: 'b6h',
g6v: 'b6v',
g7h: 'b7h',
g7v: 'b7v',
g8h: 'b8h',
g8v: 'b8v',
h1h: 'a1h',
h1v: 'a1v',
h2h: 'a2h',
h2v: 'a2v',
h3h: 'a3h',
h3v: 'a3v',
h4h: 'a4h',
h4v: 'a4v',
h5h: 'a5h',
h5v: 'a5v',
h6h: 'a6h',
h6v: 'a6v',
h7h: 'a7h',
h7v: 'a7v',
h8h: 'a8h',
h8v: 'a8v',
};
exports.isWallPositionMap = {

@@ -237,0 +448,0 @@ a1h: true,

4

lib/getHash.js

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

var player2WallCount = game.playerWallCounts[2];
var player1WallCountString = player1WallCount === 10 ? player1WallCount : "0" + player1WallCount;
var player2WallCountString = player2WallCount === 10 ? player2WallCount : "0" + player2WallCount;
var wallPositionsString = '';

@@ -23,4 +25,4 @@ for (var _i = 0, wallPositions_1 = consts_1.wallPositions; _i < wallPositions_1.length; _i++) {

}
return "" + player1Position + player2Position + player1WallCount + player2WallCount + wallPositionsString;
return "" + player1Position + player2Position + player1WallCountString + player2WallCountString + wallPositionsString;
};
exports.getHash = getHash;

@@ -17,2 +17,3 @@ export { createNewGame } from './createNewGame';

export { getHash } from './getHash';
export { mirrorHashHorizontally } from './mirrorHashHorizontally';
/**

@@ -19,0 +20,0 @@ * Deprecated. This function has been renamed to getUnicodeRepresentation.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.undoLastMove = exports.isValidMove = exports.getAsciiRepresentation = exports.getHash = exports.getShortestPath = exports.isMoveInteresting = exports.makeUnvalidatedMove = exports.isMove = exports.redo = exports.undo = exports.getTurn = exports.getValidMoveArray = exports.getWinner = exports.isGameOver = exports.makeMove = exports.getUnicodeRepresentation = exports.isMoveValid = exports.createGameFromMoves = exports.createNewGame = void 0;
exports.undoLastMove = exports.isValidMove = exports.getAsciiRepresentation = exports.mirrorHashHorizontally = exports.getHash = exports.getShortestPath = exports.isMoveInteresting = exports.makeUnvalidatedMove = exports.isMove = exports.redo = exports.undo = exports.getTurn = exports.getValidMoveArray = exports.getWinner = exports.isGameOver = exports.makeMove = exports.getUnicodeRepresentation = exports.isMoveValid = exports.createGameFromMoves = exports.createNewGame = void 0;
var createNewGame_1 = require("./createNewGame");

@@ -36,2 +36,4 @@ Object.defineProperty(exports, "createNewGame", { enumerable: true, get: function () { return createNewGame_1.createNewGame; } });

Object.defineProperty(exports, "getHash", { enumerable: true, get: function () { return getHash_1.getHash; } });
var mirrorHashHorizontally_1 = require("./mirrorHashHorizontally");
Object.defineProperty(exports, "mirrorHashHorizontally", { enumerable: true, get: function () { return mirrorHashHorizontally_1.mirrorHashHorizontally; } });
var getUnicodeRepresentation_2 = require("./getUnicodeRepresentation");

@@ -38,0 +40,0 @@ var isMoveValid_2 = require("./isMoveValid");

import { DecrementableHorizontalWallCoordinate, DecrementableVerticalWallCoordinate, Game, HorizontallyDecrementablePawnPosition, HorizontallyDecrementableWallPosition, HorizontallyIncrementablePawnPosition, HorizontalPiecePosition, HorizontalWallCoordinate, IncrementableHorizontalWallCoordinate, IncrementableVerticalWallCoordinate, PawnMove, PawnPosition, Player, VerticallyDecrementablePawnPosition, VerticallyDecrementableWallPosition, VerticallyIncrementablePawnPosition, VerticalPiecePosition, VerticalWallCoordinate, WallMove, WallOrientation, WallPosition } from './types';
declare type MirrorPositionHorizontally = {
(position: PawnPosition): PawnPosition;
(position: WallPosition): WallPosition;
};
export declare const mirrorPositionHorizontally: MirrorPositionHorizontally;
declare type GetHorizontalCoordinate = {

@@ -3,0 +8,0 @@ (move: WallPosition): HorizontalWallCoordinate;

@@ -8,3 +8,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.rest = exports.last = exports.first = exports.butlast = exports.getValidWallMoveArray = exports.overlapsPath = exports.isVerticallyDecrementableWallPosition = exports.isHorizontallyDecrementableWallPosition = exports.isDecrementableVerticalWallCoordinate = exports.isDecrementableHorizontalWallCoordinate = exports.isVerticalWallCoordinate = exports.isHorizontalWallCoordinate = exports.isWallAdjacentToAtLeastOnePawn = exports.getNumberOfNeighborWalls = exports.moveWallDown = exports.moveWallLeft = exports.getValidPawnMoveArray = exports.isHorizontallyDecrementablePawnPosition = exports.horizontallyDecrementPawnPosition = exports.isHorizontallyIncrementablePawnPosition = exports.horizontallyIncrementPawnPosition = exports.isVerticallyDecrementablePawnPosition = exports.verticallyDecrementPawnPosition = exports.isVerticallyIncrementablePawnPosition = exports.verticallyIncrementPawnPosition = exports.doesHorizontalWallBlockPlayer = exports.getShortestPathWithNoObstacles = exports.isValidNormalMove = exports.isValidAStarMove = exports.hasWallBelow = exports.hasWallToTheRight = exports.getOppositePlayer = exports.isWallPosition = exports.doesWallMoveOverlapExistingWall = exports.isPawnMove = exports.isHorizontalWallMove = exports.decrementVerticalWallCoordinate = exports.decrementHorizontalWallCoordinate = exports.getWallOrientation = exports.getVerticalCoordinate = exports.getHorizontalCoordinate = void 0;
exports.rest = exports.last = exports.first = exports.butlast = exports.getValidWallMoveArray = exports.overlapsPath = exports.isVerticallyDecrementableWallPosition = exports.isHorizontallyDecrementableWallPosition = exports.isDecrementableVerticalWallCoordinate = exports.isDecrementableHorizontalWallCoordinate = exports.isVerticalWallCoordinate = exports.isHorizontalWallCoordinate = exports.isWallAdjacentToAtLeastOnePawn = exports.getNumberOfNeighborWalls = exports.moveWallDown = exports.moveWallLeft = exports.getValidPawnMoveArray = exports.isHorizontallyDecrementablePawnPosition = exports.horizontallyDecrementPawnPosition = exports.isHorizontallyIncrementablePawnPosition = exports.horizontallyIncrementPawnPosition = exports.isVerticallyDecrementablePawnPosition = exports.verticallyDecrementPawnPosition = exports.isVerticallyIncrementablePawnPosition = exports.verticallyIncrementPawnPosition = exports.doesHorizontalWallBlockPlayer = exports.getShortestPathWithNoObstacles = exports.isValidNormalMove = exports.isValidAStarMove = exports.hasWallBelow = exports.hasWallToTheRight = exports.getOppositePlayer = exports.isWallPosition = exports.doesWallMoveOverlapExistingWall = exports.isPawnMove = exports.isHorizontalWallMove = exports.decrementVerticalWallCoordinate = exports.decrementHorizontalWallCoordinate = exports.getWallOrientation = exports.getVerticalCoordinate = exports.getHorizontalCoordinate = exports.mirrorPositionHorizontally = void 0;
var consts_1 = require("./consts");

@@ -14,2 +14,6 @@ var getShortestPath_1 = require("./getShortestPath");

var makeUnvalidatedMove_1 = require("./makeUnvalidatedMove");
var mirrorPositionHorizontally = function (position) {
return consts_1.horizontallyMirroredPositionsMap[position];
};
exports.mirrorPositionHorizontally = mirrorPositionHorizontally;
var getHorizontalCoordinate = function (move) {

@@ -16,0 +20,0 @@ return move.charAt(0);

{
"name": "quoridor",
"version": "2.2.1",
"version": "2.3.0",
"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