New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 7.0.0 to 7.1.0

1

dist/chess/Chess.d.ts

@@ -128,2 +128,3 @@ import { Squares, Colors } from '../types/Types';

moveToPly(hmNumber: number): void;
findNextMistake(color: Colors.BW, ply: number, type: "blunder" | "mistake" | "inaccuracy"): number | undefined;
getResultName(mode: 'char' | 'short' | 'long' | 'html'): string;

@@ -130,0 +131,0 @@ static plyToTurn(ply: number): number;

32

dist/chess/Chess.js

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

this.supressEvents = false;
this.moveList = {};
this.moveList = new Map();
this.startFen = FenString_1.FenString.standartStart;

@@ -253,3 +253,3 @@ this.InPromotion = false;

clearMoves() {
this.moveList = {};
this.moveList.clear();
this.InPromotion = false;

@@ -261,3 +261,3 @@ this.NoQueenPromotion = false;

this.currentMove = Move_1.Move.init(this.startFen, this.startPos);
this.moveList[this.currentMove.Prev.moveKey] = this.currentMove.Prev;
this.moveList.set(this.currentMove.Prev.moveKey, this.currentMove.Prev);
// Set up start

@@ -379,4 +379,3 @@ this.curPos = new Position_1.Position();

move.id = mv.id || shortid.generate();
move.data = mv;
this.moveList[move.moveKey] = move;
this.moveList.set(move.moveKey, move);
}

@@ -522,4 +521,4 @@ }

moveToKey(key) {
if (this.moveList[key]) {
const targetMove = this.moveList[key];
const targetMove = this.moveList.get(key);
if (targetMove) {
if (!targetMove.inVariation()) {

@@ -636,2 +635,21 @@ this.moveToPly(targetMove.PlyCount);

}
findNextMistake(color, ply, type) {
if (!this.currentMove.inVariation()) {
const judgments = Array.from(this.moveList.values()).filter((value) => {
const sm = value.sm;
return ((sm.color === color) && (sm.judgments) && (sm.judgments.length) && (type === sm.judgments[0].name.toLowerCase()));
});
if (judgments.length > 0) {
const right = judgments.filter((value) => { return value.sm.ply > ply; });
if (right.length > 0) {
return right[0].PlyCount;
}
const left = judgments.filter((value) => { return value.sm.ply < ply; });
if (left.length > 0) {
return left[0].PlyCount;
}
}
}
return undefined;
}
getResultName(mode) {

@@ -638,0 +656,0 @@ if (mode === "char") {

import { SimpleMove } from './SimpleMove';
import { Colors } from '../types/Types';
import { ITreePart, IMovePart } from '../types/Interfaces';
import { Position } from './Position';

@@ -23,4 +22,3 @@ /**

fen: string;
sm: SimpleMove | null;
data?: ITreePart | IMovePart;
sm: SimpleMove;
/**

@@ -27,0 +25,0 @@ * @constructor

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

this.fen = "";
this.sm = null;
this.sm = new SimpleMove_1.SimpleMove();
this.whoMove = Color_1.Color.White;

@@ -37,4 +37,2 @@ this.ply = 0;

firstMove.fen = fen;
firstMove.ply = 0;
firstMove.sm = new SimpleMove_1.SimpleMove();
firstMove.START_MARKER = true;

@@ -44,4 +42,2 @@ firstMove.END_MARKER = false;

firstMove.next_move.name = "LastMove";
firstMove.next_move.ply = 0;
firstMove.next_move.sm = new SimpleMove_1.SimpleMove();
firstMove.next_move.START_MARKER = false;

@@ -48,0 +44,0 @@ firstMove.next_move.END_MARKER = true;

{
"name": "onix-chess",
"version": "7.0.0",
"version": "7.1.0",
"description": "Onix chess library",

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

@@ -18,3 +18,2 @@ import toSafeInteger from 'lodash-es/toSafeInteger';

import { EvalItem } from '../analysis/EvalItem';
import { setMaxListeners } from 'process';

@@ -160,3 +159,3 @@ export enum ChessRatingType {

private supressEvents = false;
private moveList: { [index: string]: Move } = {};
private moveList: Map<string, Move> = new Map<string, Move>();

@@ -312,3 +311,3 @@ private currentMove!: Move;

private clearMoves () {
this.moveList = {};
this.moveList.clear();
this.InPromotion = false;

@@ -322,3 +321,3 @@ this.NoQueenPromotion = false;

this.currentMove = Move.init(this.startFen, this.startPos);
this.moveList[this.currentMove.Prev.moveKey] = this.currentMove.Prev;
this.moveList.set(this.currentMove.Prev.moveKey, this.currentMove.Prev);

@@ -455,4 +454,3 @@ // Set up start

move.id = mv.id || shortid.generate();
move.data = mv;
this.moveList[move.moveKey] = move;
this.moveList.set(move.moveKey, move);
}

@@ -617,4 +615,4 @@ }

public moveToKey(key: string) {
if (this.moveList[key]) {
const targetMove = this.moveList[key];
const targetMove = this.moveList.get(key);
if (targetMove) {
if (!targetMove.inVariation()) {

@@ -748,2 +746,25 @@ this.moveToPly(targetMove.PlyCount);

public findNextMistake(color: Colors.BW, ply: number, type: "blunder" | "mistake" | "inaccuracy"): number | undefined {
if (!this.currentMove.inVariation()) {
const judgments = Array.from(this.moveList.values()).filter((value) => {
const sm = value.sm;
return ((sm.color === color) && (sm.judgments) && (sm.judgments.length) && (type === sm.judgments[0].name.toLowerCase()));
});
if (judgments.length > 0) {
const right = judgments.filter((value) => { return value.sm.ply > ply});
if (right.length > 0) {
return right[0].PlyCount;
}
const left = judgments.filter((value) => { return value.sm.ply < ply});
if (left.length > 0) {
return left[0].PlyCount;
}
}
}
return undefined;
}
public getResultName(mode: 'char' | 'short' | 'long' | 'html'): string {

@@ -750,0 +771,0 @@ if (mode === "char") {

@@ -32,4 +32,3 @@ import * as shortid from 'shortid';

public sm: SimpleMove | null;
public data?: ITreePart | IMovePart;
public sm: SimpleMove;

@@ -44,3 +43,3 @@ /**

this.fen = "";
this.sm = null;
this.sm = new SimpleMove();
this.whoMove = Color.White;

@@ -59,4 +58,2 @@ this.ply = 0;

firstMove.fen = fen;
firstMove.ply = 0;
firstMove.sm = new SimpleMove();
firstMove.START_MARKER = true;

@@ -67,4 +64,2 @@ firstMove.END_MARKER = false;

firstMove.next_move.name = "LastMove";
firstMove.next_move.ply = 0;
firstMove.next_move.sm = new SimpleMove();
firstMove.next_move.START_MARKER = false;

@@ -71,0 +66,0 @@ firstMove.next_move.END_MARKER = true;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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