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

onix-chess

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onix-chess - npm Package Compare versions

Comparing version 1.2.17 to 1.3.18

2

dist/app/IChessUser.js

@@ -1,3 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IChessUser.js.map

4

dist/chess/Castle.js

@@ -1,3 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**

@@ -17,3 +15,3 @@ * Castle side

}());
exports.Castle = Castle;
export { Castle };
//# sourceMappingURL=Castle.js.map

@@ -1,13 +0,11 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var toSafeInteger = require("lodash/toSafeInteger");
var isNumber = require("lodash/isNumber");
var indexOf = require("lodash/indexOf");
var Color_1 = require("./Color");
var Piece_1 = require("./Piece");
var Square_1 = require("./Square");
var Position_1 = require("./Position");
var Move_1 = require("./Move");
var SimpleMove_1 = require("./SimpleMove");
var ChessRatingType;
import toSafeInteger from 'lodash-es/toSafeInteger';
import isNumber from 'lodash-es/isNumber';
import indexOf from 'lodash-es/indexOf';
import { Color } from './Color';
import { Piece } from './Piece';
import { Square } from './Square';
import { Position, FenStandartStart, ChessPositionStd, SanCheckLevel, GenerateMode } from './Position';
import { Move } from './Move';
import { SimpleMove } from './SimpleMove';
export var ChessRatingType;
(function (ChessRatingType) {

@@ -19,3 +17,3 @@ ChessRatingType[ChessRatingType["None"] = 0] = "None";

ChessRatingType[ChessRatingType["Iccf"] = 4] = "Iccf";
})(ChessRatingType = exports.ChessRatingType || (exports.ChessRatingType = {}));
})(ChessRatingType || (ChessRatingType = {}));
var ChessRatingNames = ["Unknown", "Elo", "Rating", "Rapid", "ICCF"];

@@ -100,4 +98,4 @@ function chessRatingParseType(value) {

}());
exports.ChessTags = ChessTags;
var ChessResultColor;
export { ChessTags };
export var ChessResultColor;
(function (ChessResultColor) {

@@ -108,3 +106,3 @@ ChessResultColor[ChessResultColor["None"] = 0] = "None";

ChessResultColor[ChessResultColor["Draw"] = 3] = "Draw";
})(ChessResultColor = exports.ChessResultColor || (exports.ChessResultColor = {}));
})(ChessResultColor || (ChessResultColor = {}));
var ChessResultType;

@@ -139,3 +137,3 @@ (function (ChessResultType) {

}());
exports.ChessGameState = ChessGameState;
export { ChessGameState };
var Chess = /** @class */ (function () {

@@ -149,3 +147,3 @@ /**

this.moveList = {};
this.startFen = Position_1.FenStandartStart;
this.startFen = FenStandartStart;
this.settings = settings || {};

@@ -155,8 +153,8 @@ this.Tags = new ChessTags(this);

this.pgnLastMovePos = this.pgnNextMovePos = 0;
if (this.settings.fen && (this.settings.fen != Position_1.FenStandartStart)) {
if (this.settings.fen && (this.settings.fen != FenStandartStart)) {
this.startFen = this.settings.fen;
this.startPos = new Position_1.Position(this.settings.fen);
this.startPos = new Position(this.settings.fen);
}
else {
this.startPos = Position_1.ChessPositionStd;
this.startPos = ChessPositionStd;
}

@@ -190,3 +188,3 @@ this.clear();

get: function () {
return this.startFen !== Position_1.FenStandartStart;
return this.startFen !== FenStandartStart;
},

@@ -239,5 +237,5 @@ enumerable: true,

this.savedPos = null;
this.currentMove = Move_1.Move.init(this.startFen);
this.currentMove = Move.init(this.startFen);
// Set up start
this.currentPos = new Position_1.Position();
this.currentPos = new Position();
this.currentPos.copyFrom(this.startPos);

@@ -263,3 +261,3 @@ this.StartPlyCount = this.currentPos.PlyCount;

var mv = moves[i];
var sm = new SimpleMove_1.SimpleMove();
var sm = new SimpleMove();
sm.PlyCount = this.CurrentPos.PlyCount + 1;

@@ -290,3 +288,3 @@ sm.From = mv[0] & 63;

var state = new ChessGameState();
var mlist = this.currentPos.generateMoves(Piece_1.Piece.NoPiece, Position_1.GenerateMode.All, true);
var mlist = this.currentPos.generateMoves(Piece.NoPiece, GenerateMode.All, true);
if (mlist.length === 0) {

@@ -300,14 +298,14 @@ if (this.currentPos.isKingInCheck()) {

}
if ((!this.currentPos.hasPiece(Piece_1.Piece.WPawn)) &&
(!this.currentPos.hasPiece(Piece_1.Piece.WQueen)) &&
(!this.currentPos.hasPiece(Piece_1.Piece.WRook))) {
if ((!this.currentPos.hasPiece(Piece_1.Piece.WKnight)) && (!this.currentPos.hasPiece(Piece_1.Piece.WBishop))) {
if ((!this.currentPos.hasPiece(Piece.WPawn)) &&
(!this.currentPos.hasPiece(Piece.WQueen)) &&
(!this.currentPos.hasPiece(Piece.WRook))) {
if ((!this.currentPos.hasPiece(Piece.WKnight)) && (!this.currentPos.hasPiece(Piece.WBishop))) {
// King only
state.IsNoMaterialWhite = true;
}
else if ((!this.currentPos.hasPiece(Piece_1.Piece.WKnight)) && (this.currentPos.getPieceCount(Piece_1.Piece.WBishop) === 1)) {
else if ((!this.currentPos.hasPiece(Piece.WKnight)) && (this.currentPos.getPieceCount(Piece.WBishop) === 1)) {
// King and bishop
state.IsNoMaterialWhite = true;
}
else if ((this.currentPos.getPieceCount(Piece_1.Piece.WKnight) === 1) && (!this.currentPos.hasPiece(Piece_1.Piece.WBishop))) {
else if ((this.currentPos.getPieceCount(Piece.WKnight) === 1) && (!this.currentPos.hasPiece(Piece.WBishop))) {
// King and knight

@@ -317,14 +315,14 @@ state.IsNoMaterialWhite = true;

}
if ((!this.currentPos.hasPiece(Piece_1.Piece.BPawn)) &&
(!this.currentPos.hasPiece(Piece_1.Piece.BQueen)) &&
(!this.currentPos.hasPiece(Piece_1.Piece.BRook))) {
if ((!this.currentPos.hasPiece(Piece_1.Piece.BKnight)) && (!this.currentPos.hasPiece(Piece_1.Piece.BBishop))) {
if ((!this.currentPos.hasPiece(Piece.BPawn)) &&
(!this.currentPos.hasPiece(Piece.BQueen)) &&
(!this.currentPos.hasPiece(Piece.BRook))) {
if ((!this.currentPos.hasPiece(Piece.BKnight)) && (!this.currentPos.hasPiece(Piece.BBishop))) {
// King only
state.IsNoMaterialBlack = true;
}
else if ((!this.currentPos.hasPiece(Piece_1.Piece.BKnight)) && (this.currentPos.getPieceCount(Piece_1.Piece.BBishop) === 1)) {
else if ((!this.currentPos.hasPiece(Piece.BKnight)) && (this.currentPos.getPieceCount(Piece.BBishop) === 1)) {
// King and bishop
state.IsNoMaterialBlack = true;
}
else if ((this.currentPos.getPieceCount(Piece_1.Piece.BKnight) === 1) && (!this.currentPos.hasPiece(Piece_1.Piece.BBishop))) {
else if ((this.currentPos.getPieceCount(Piece.BKnight) === 1) && (!this.currentPos.hasPiece(Piece.BBishop))) {
// King and knight

@@ -348,6 +346,6 @@ state.IsNoMaterialBlack = true;

var currentPos = this.currentPos;
var sm = new SimpleMove_1.SimpleMove();
var sm = new SimpleMove();
sm.PieceNum = currentPos.getPieceNum(fr);
sm.MovingPiece = currentPos.getPiece(fr);
sm.Color = Piece_1.Piece.color(sm.MovingPiece);
sm.Color = Piece.color(sm.MovingPiece);
sm.From = fr;

@@ -359,9 +357,9 @@ sm.To = to;

sm.EpSquare = currentPos.EpTarget;
sm.Promote = Piece_1.Piece.NoPiece;
sm.Promote = Piece.NoPiece;
var piece = sm.MovingPiece;
var ptype = Piece_1.Piece.type(piece);
var enemy = Color_1.Color.flip(currentPos.WhoMove);
var ptype = Piece.type(piece);
var enemy = Color.flip(currentPos.WhoMove);
// handle promotion:
var promoteRank = (currentPos.WhoMove === Color_1.Color.White ? 7 : 0);
if ((ptype == Piece_1.Piece.Pawn) && (Square_1.Square.rank(to) == promoteRank)) {
var promoteRank = (currentPos.WhoMove === Color.White ? 7 : 0);
if ((ptype == Piece.Pawn) && (Square.rank(to) == promoteRank)) {
if (!promote) {

@@ -372,9 +370,9 @@ this.InPromotion = true;

else {
sm.Promote = Piece_1.Piece.typeFromChar(promote);
sm.Promote = Piece.typeFromChar(promote);
}
}
// Handle en passant capture:
if (ptype == Piece_1.Piece.Pawn && (sm.CapturedPiece == Piece_1.Piece.NoPiece) && (Square_1.Square.fyle(fr) != Square_1.Square.fyle(to))) {
var enemyPawn = Piece_1.Piece.create(enemy, Piece_1.Piece.Pawn);
sm.CapturedSquare = (this.currentPos.WhoMove === Color_1.Color.White ? (to - 8) : (to + 8));
if (ptype == Piece.Pawn && (sm.CapturedPiece == Piece.NoPiece) && (Square.fyle(fr) != Square.fyle(to))) {
var enemyPawn = Piece.create(enemy, Piece.Pawn);
sm.CapturedSquare = (this.currentPos.WhoMove === Color.White ? (to - 8) : (to + 8));
sm.CapturedPiece = enemyPawn;

@@ -398,3 +396,3 @@ }

if (!san || (san == undefined)) {
sm.San = this.currentPos.makeSanString(sm, Position_1.SanCheckLevel.MateTest);
sm.San = this.currentPos.makeSanString(sm, SanCheckLevel.MateTest);
}

@@ -445,3 +443,3 @@ else {

this.currentMove = this.moveList[key];
this.currentPos = new Position_1.Position(this.currentMove.Fen);
this.currentPos = new Position(this.currentMove.Fen);
this.CurrentPlyCount = this.currentPos.PlyCount;

@@ -514,6 +512,6 @@ this.currentMove = this.currentMove.Next;

startPly = startPly || 0;
return (((ply + startPly) % 2) == 1) ? Color_1.Color.White : Color_1.Color.Black;
return (((ply + startPly) % 2) == 1) ? Color.White : Color.Black;
};
Chess.turnToPly = function (turn, color) {
color = color || Color_1.Color.White;
color = color || Color.White;
var ply = (((turn - 1) * 2) + color + 1);

@@ -523,3 +521,3 @@ };

}());
exports.Chess = Chess;
export { Chess };
//# sourceMappingURL=Chess.js.map

@@ -1,3 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var WHITE = 0;

@@ -23,3 +21,3 @@ var BLACK = 1;

}());
exports.Color = Color;
export { Color };
//# sourceMappingURL=Color.js.map

@@ -1,3 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**

@@ -243,3 +241,3 @@ * Zero (invalid) square

}());
exports.Direction = Direction;
export { Direction };
//# sourceMappingURL=Direction.js.map

@@ -1,3 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IOpeningPosition.js.map

@@ -1,7 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var shortid = require("shortid");
var Color_1 = require("./Color");
var Piece_1 = require("./Piece");
var Square_1 = require("./Square");
import * as shortid from 'shortid';
import { Color } from './Color';
import { Piece } from './Piece';
import { Square } from './Square';
/**

@@ -22,10 +20,10 @@ * Move in position

this.moveData = null;
this.from = Square_1.Square.NullSquare;
this.to = Square_1.Square.NullSquare;
this.color = Color_1.Color.NoColor;
this.capturedSquare = Square_1.Square.NullSquare;
this.capturedPiece = Piece_1.Piece.NoPiece;
this.promote = Piece_1.Piece.NoPiece;
this.from = Square.NullSquare;
this.to = Square.NullSquare;
this.color = Color.NoColor;
this.capturedSquare = Square.NullSquare;
this.capturedPiece = Piece.NoPiece;
this.promote = Piece.NoPiece;
this.piece_num = 0;
this.WhoMove = Color_1.Color.White;
this.WhoMove = Color.White;
this.ply = 0;

@@ -196,3 +194,3 @@ this.Comments = "";

}());
exports.Move = Move;
export { Move };
//# sourceMappingURL=Move.js.map

@@ -1,4 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Color_1 = require("./Color");
import { Color } from './Color';
/**

@@ -28,3 +26,3 @@ * Zero (empty) piece

Piece.color = function (p) {
return (p === noPiece) ? Color_1.Color.NoColor : ((p & 0x08) >> 3);
return (p === noPiece) ? Color.NoColor : ((p & 0x08) >> 3);
};

@@ -116,3 +114,3 @@ /**

}());
exports.Piece = Piece;
export { Piece };
//# sourceMappingURL=Piece.js.map

@@ -1,6 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Color_1 = require("./Color");
var Piece_1 = require("./Piece");
var Square_1 = require("./Square");
import { Color } from './Color';
import { Piece } from './Piece';
import { Square } from './Square';
/**

@@ -12,12 +10,12 @@ * Move data.

this.PieceNum = 0;
this.MovingPiece = Piece_1.Piece.NoPiece;
this.From = Square_1.Square.NullSquare;
this.To = Square_1.Square.NullSquare;
this.Color = Color_1.Color.NoColor;
this.MovingPiece = Piece.NoPiece;
this.From = Square.NullSquare;
this.To = Square.NullSquare;
this.Color = Color.NoColor;
this.CapturedNum = 0;
this.CapturedPiece = Piece_1.Piece.NoPiece;
this.Promote = Piece_1.Piece.NoPiece;
this.CapturedSquare = Square_1.Square.NullSquare; // only different to "to" field if this capture is an en passant capture.
this.CapturedPiece = Piece.NoPiece;
this.Promote = Piece.NoPiece;
this.CapturedSquare = Square.NullSquare; // only different to "to" field if this capture is an en passant capture.
this.CastleFlags = 0;
this.EpSquare = Square_1.Square.NullSquare;
this.EpSquare = Square.NullSquare;
this.OldHalfMoveClock = 0;

@@ -35,3 +33,3 @@ this.PlyCount = 0;

}());
exports.SimpleMove = SimpleMove;
export { SimpleMove };
//# sourceMappingURL=SimpleMove.js.map

@@ -1,5 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Color_1 = require("./Color");
var Direction_1 = require("./Direction");
import { Color } from './Color';
import { Direction } from './Direction';
/**

@@ -280,3 +278,3 @@ * Zero (invalid) square

Square.colorChar = function (sq) {
return (Square.color(sq) === Color_1.Color.Black) ? Color_1.Color.BlackChar : Color_1.Color.WhiteChar;
return (Square.color(sq) === Color.Black) ? Color.BlackChar : Color.WhiteChar;
};

@@ -322,6 +320,6 @@ Square.rankChar = function (sq) {

Square.direction = function (fr, to) {
return Direction_1.Direction.squareDirection(fr, to);
return Direction.squareDirection(fr, to);
};
Square.move = function (sq, dir) {
return Direction_1.Direction.squareMove(sq, dir);
return Direction.squareMove(sq, dir);
};

@@ -354,3 +352,3 @@ Square.last = function (sq, dir) {

}());
exports.Square = Square;
export { Square };
//# sourceMappingURL=Square.js.map

@@ -1,23 +0,10 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Intl_1 = require("./Intl");
exports.Intl = Intl_1.Intl;
var Color_1 = require("./chess/Color");
exports.Color = Color_1.Color;
var Castle_1 = require("./chess/Castle");
exports.Castle = Castle_1.Castle;
var Piece_1 = require("./chess/Piece");
exports.Piece = Piece_1.Piece;
var Square_1 = require("./chess/Square");
exports.Square = Square_1.Square;
var Move_1 = require("./chess/Move");
exports.Move = Move_1.Move;
var SimpleMove_1 = require("./chess/SimpleMove");
exports.SimpleMove = SimpleMove_1.SimpleMove;
var Position_1 = require("./chess/Position");
exports.Position = Position_1.Position;
exports.FenStandartStart = Position_1.FenStandartStart;
exports.FenEmptyBoard = Position_1.FenEmptyBoard;
var Chess_1 = require("./chess/Chess");
exports.Chess = Chess_1.Chess;
export { Intl } from './Intl';
export { Color } from './chess/Color';
export { Castle } from './chess/Castle';
export { Piece } from './chess/Piece';
export { Square } from './chess/Square';
export { Move } from './chess/Move';
export { SimpleMove } from './chess/SimpleMove';
export { Position, FenStandartStart, FenEmptyBoard } from './chess/Position';
export { Chess } from './chess/Chess';
//# sourceMappingURL=index.js.map

@@ -1,4 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var onix_core_1 = require("onix-core");
import { Intl as IntlCore } from 'onix-core';
var Intl = /** @class */ (function () {

@@ -9,4 +7,4 @@ function Intl() {

if (!Intl.intlInitialized) {
onix_core_1.Intl.register();
onix_core_1.Intl.registerStrings('chess', {
IntlCore.register();
IntlCore.registerStrings('chess', {
'ru-ru': {

@@ -53,3 +51,3 @@ fen: "FEN",

}());
exports.Intl = Intl;
export { Intl };
//# sourceMappingURL=Intl.js.map
{
"name": "onix-chess",
"version": "1.2.17",
"version": "1.3.18",
"description": "Onix chess library",

@@ -9,2 +9,5 @@ "main": "dist/index.js",

"build": "tsc",
"webpack": "webpack --config webpack.config.js",
"stats": "webpack --profile --json > stats.json",
"statsp": "webpack --profile --json --mode=production > stats.json",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -24,12 +27,16 @@ },

"dependencies": {
"lodash": "^4.17.5",
"onix-core": "^1.2.32",
"shortid": "^2.2.6",
"warning": "^3.0.0"
"lodash-es": "^4.17.10",
"onix-core": "^1.6.39",
"shortid": "^2.2.8",
"warning": "^4.0.0"
},
"devDependencies": {
"@types/lodash": "^4.14.104",
"@types/node": "^7.0.55",
"typescript": "^2.9.2"
"@types/lodash-es": "^4.17.0",
"@types/node": "^10.5.1",
"clean-webpack-plugin": "^0.1.19",
"ts-loader": "^4.4.2",
"typescript": "^2.9.2",
"webpack": "^4.14.0",
"webpack-cli": "^3.0.8"
}
}

@@ -1,5 +0,5 @@

import toSafeInteger = require('lodash/toSafeInteger');
import isInteger = require('lodash/isInteger');
import isNumber = require('lodash/isNumber');
import indexOf = require('lodash/indexOf');
import toSafeInteger from 'lodash-es/toSafeInteger';
import isNumber from 'lodash-es/isNumber';
import indexOf from 'lodash-es/indexOf';
import { Hashtable } from 'onix-core';

@@ -6,0 +6,0 @@ import { Color } from './Color';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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