onix-chess
Advanced tools
Comparing version 5.3.6 to 5.4.0
import { Position } from './Position'; | ||
import { Move } from './Move'; | ||
import { SimpleMove } from './SimpleMove'; | ||
import { IGameData, IChessPlayer } from '../types/Interfaces'; | ||
import { IGameData, IChessPlayer, IChessOpening } from '../types/Interfaces'; | ||
import { Squares, Colors } from '../types/Types'; | ||
@@ -75,3 +75,3 @@ export declare enum ChessRatingType { | ||
BlackRatingType?: ChessRatingType; | ||
EcoCode?: string; | ||
Eco?: IChessOpening; | ||
Result: ChessResultColor; | ||
@@ -78,0 +78,0 @@ /** |
@@ -84,3 +84,5 @@ "use strict"; | ||
case "ecocode": | ||
this.owner.EcoCode = value; | ||
this.owner.Eco = { | ||
code: value | ||
}; | ||
break; | ||
@@ -226,3 +228,3 @@ case "fen": | ||
if (game.opening) { | ||
this.EcoCode = game.opening.code; | ||
this.Eco = game.opening; | ||
} | ||
@@ -261,5 +263,6 @@ } | ||
if (sm !== null) { | ||
sm.plyCount = this.CurrentPos.PlyCount + 1; | ||
sm.ply = this.CurrentPos.PlyCount + 1; | ||
sm.permanent = true; | ||
sm.san = mv.san; | ||
sm.color = this.CurrentPos.WhoMove; | ||
if (this.isInstanceOfTreePart(mv)) { | ||
@@ -311,3 +314,5 @@ if (mv.comments && (mv.comments.length > 0)) { | ||
this.EventDate = "????.??.??"; | ||
this.EcoCode = "A00"; | ||
this.Eco = { | ||
code: "A00" | ||
}; | ||
this.Result = ChessResultColor.None; | ||
@@ -314,0 +319,0 @@ this.WhiteElo = this.BlackElo = 0; |
@@ -29,10 +29,12 @@ import { SimpleMove } from './SimpleMove'; | ||
static init(fen?: string, parent?: Move | null): Move; | ||
isFirst(): boolean | null; | ||
isBegin(): boolean; | ||
get First(): Move; | ||
isFirst(): boolean; | ||
isLast(): boolean; | ||
isEnd(): boolean; | ||
get Begin(): Move; | ||
get First(): Move | null; | ||
get Prev(): Move | null; | ||
get Next(): Move | null; | ||
isLast(): boolean | null; | ||
isEnd(): boolean; | ||
get Last(): Move; | ||
get Last(): Move | null; | ||
get End(): Move; | ||
get PlyCount(): number; | ||
@@ -39,0 +41,0 @@ get numVars(): number; |
@@ -52,9 +52,15 @@ "use strict"; | ||
} | ||
isFirst() { | ||
return this.START_MARKER || (this.prev_move && this.prev_move.START_MARKER); | ||
} | ||
isBegin() { | ||
return this.START_MARKER; | ||
} | ||
get First() { | ||
isFirst() { | ||
return this.START_MARKER || ((this.prev_move !== null) && this.prev_move.START_MARKER); | ||
} | ||
isLast() { | ||
return this.END_MARKER || ((this.next_move !== null) && this.next_move.END_MARKER); | ||
} | ||
isEnd() { | ||
return this.END_MARKER; | ||
} | ||
get Begin() { | ||
let move = this; | ||
@@ -66,2 +72,6 @@ while (move.prev_move) { | ||
} | ||
get First() { | ||
const move = this.Begin.Next; | ||
return ((move !== null) && (!move.isEnd)) ? move : null; | ||
} | ||
get Prev() { | ||
@@ -73,9 +83,7 @@ return this.prev_move; | ||
} | ||
isLast() { | ||
return this.END_MARKER || (this.next_move && this.next_move.END_MARKER); | ||
get Last() { | ||
const move = this.End.Prev; | ||
return ((move !== null) && (!move.isBegin)) ? move : null; | ||
} | ||
isEnd() { | ||
return this.END_MARKER; | ||
} | ||
get Last() { | ||
get End() { | ||
let move = this; | ||
@@ -135,4 +143,4 @@ while (move.next_move) { | ||
newMove.sm = sm; | ||
newMove.name = sm.san ? sm.san : sm.plyCount.toString(); | ||
newMove.ply = sm.plyCount; | ||
newMove.name = sm.san ? sm.san : sm.ply.toString(); | ||
newMove.ply = sm.ply; | ||
newMove.next_move = this; | ||
@@ -139,0 +147,0 @@ newMove.prev_move = this.prev_move; |
@@ -18,3 +18,3 @@ import { Colors, Pieces, Squares } from '../types/Types'; | ||
oldHalfMoveClock: number; | ||
plyCount: number; | ||
ply: number; | ||
san?: string; | ||
@@ -21,0 +21,0 @@ comments?: string; |
@@ -26,3 +26,3 @@ "use strict"; | ||
this.oldHalfMoveClock = 0; | ||
this.plyCount = 0; | ||
this.ply = 0; | ||
this.permanent = true; | ||
@@ -29,0 +29,0 @@ } |
@@ -13,3 +13,2 @@ export { register as i18nRegister } from './i18n'; | ||
export { Position } from './chess/Position'; | ||
export { IOpeningPosition } from './types/IOpeningPosition'; | ||
export { Chess } from './chess/Chess'; |
@@ -31,3 +31,4 @@ import { IUser } from 'onix-core/dist/app/IUser'; | ||
code: string; | ||
name: string; | ||
name?: string; | ||
fen?: string; | ||
} | ||
@@ -34,0 +35,0 @@ export interface IChessGame { |
{ | ||
"name": "onix-chess", | ||
"version": "5.3.6", | ||
"version": "5.4.0", | ||
"description": "Onix chess library", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -12,3 +12,3 @@ import toSafeInteger from 'lodash-es/toSafeInteger'; | ||
import { SimpleMove } from './SimpleMove'; | ||
import { IChessUser, IChessGame, IGameData, IMovePart, ITreePart, IChessPlayer } from '../types/Interfaces'; | ||
import { IChessUser, IChessGame, IGameData, IMovePart, ITreePart, IChessPlayer, IChessOpening } from '../types/Interfaces'; | ||
import { FenString } from './FenString'; | ||
@@ -94,3 +94,5 @@ import { Squares, Colors } from '../types/Types'; | ||
case "ecocode": | ||
this.owner.EcoCode = value; | ||
this.owner.Eco = { | ||
code: value | ||
} | ||
break; | ||
@@ -230,3 +232,3 @@ case "fen": | ||
public BlackRatingType?: ChessRatingType; | ||
public EcoCode?: string; | ||
public Eco?: IChessOpening; | ||
public Result: ChessResultColor = ChessResultColor.None; | ||
@@ -282,3 +284,3 @@ | ||
if (game.opening) { | ||
this.EcoCode = game.opening.code; | ||
this.Eco = game.opening; | ||
} | ||
@@ -323,5 +325,6 @@ } | ||
if (sm !== null) { | ||
sm.plyCount = this.CurrentPos.PlyCount + 1; | ||
sm.ply = this.CurrentPos.PlyCount + 1; | ||
sm.permanent = true; | ||
sm.san = mv.san; | ||
sm.color = this.CurrentPos.WhoMove; | ||
if (this.isInstanceOfTreePart(mv)) { | ||
@@ -380,3 +383,5 @@ if (mv.comments && (mv.comments.length > 0)) { | ||
this.EventDate = "????.??.??"; | ||
this.EcoCode = "A00"; | ||
this.Eco = { | ||
code: "A00" | ||
}; | ||
this.Result = ChessResultColor.None; | ||
@@ -383,0 +388,0 @@ this.WhiteElo = this.BlackElo = 0; |
@@ -77,11 +77,19 @@ import * as shortid from 'shortid'; | ||
public isBegin() { | ||
return this.START_MARKER; | ||
} | ||
public isFirst() { | ||
return this.START_MARKER || (this.prev_move && this.prev_move.START_MARKER); | ||
return this.START_MARKER || ((this.prev_move !== null) && this.prev_move.START_MARKER); | ||
} | ||
public isBegin() { | ||
return this.START_MARKER; | ||
public isLast() { | ||
return this.END_MARKER || ((this.next_move !== null) && this.next_move.END_MARKER); | ||
} | ||
public get First() : Move { | ||
public isEnd() { | ||
return this.END_MARKER; | ||
} | ||
public get Begin() : Move { | ||
let move: Move = this; | ||
@@ -95,2 +103,7 @@ while (move.prev_move) { | ||
public get First() : Move | null { | ||
const move = this.Begin.Next; | ||
return ((move !== null) && (!move.isEnd)) ? move : null; | ||
} | ||
public get Prev(): Move | null { | ||
@@ -104,11 +117,8 @@ return this.prev_move; | ||
public isLast() { | ||
return this.END_MARKER || (this.next_move && this.next_move.END_MARKER); | ||
public get Last(): Move | null { | ||
const move = this.End.Prev; | ||
return ((move !== null) && (!move.isBegin)) ? move : null; | ||
} | ||
public isEnd() { | ||
return this.END_MARKER; | ||
} | ||
public get Last() { | ||
public get End() { | ||
let move: Move = this; | ||
@@ -180,4 +190,4 @@ while (move.next_move) { | ||
newMove.sm = sm; | ||
newMove.name = sm.san ? sm.san : sm.plyCount.toString(); | ||
newMove.ply = sm.plyCount; | ||
newMove.name = sm.san ? sm.san : sm.ply.toString(); | ||
newMove.ply = sm.ply; | ||
@@ -184,0 +194,0 @@ newMove.next_move = this; |
@@ -26,3 +26,3 @@ import { Colors, Pieces, Squares } from '../types/Types'; | ||
public plyCount = 0; | ||
public ply = 0; | ||
public san?: string; | ||
@@ -29,0 +29,0 @@ public comments?: string; |
@@ -13,3 +13,2 @@ export { register as i18nRegister } from './i18n'; | ||
export { Position } from './chess/Position'; | ||
export { IOpeningPosition } from './types/IOpeningPosition'; | ||
export { Chess } from './chess/Chess'; |
@@ -44,3 +44,4 @@ import { IUser } from 'onix-core/dist/app/IUser'; | ||
code: string; | ||
name: string; | ||
name?: string; | ||
fen?: string | ||
} | ||
@@ -47,0 +48,0 @@ |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
464656
8834
70