onix-chess
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -131,2 +131,5 @@ import { Position } from './Position'; | ||
getResultName(mode: 'char' | 'short' | 'long' | 'html'): string; | ||
static plyToTurn(ply: number, startPly?: number): number; | ||
static plyToColor(ply: number, startPly?: number): number; | ||
static turnToPly(turn: number, color?: number): void; | ||
} |
@@ -490,2 +490,14 @@ "use strict"; | ||
}; | ||
Chess.plyToTurn = function (ply, startPly) { | ||
startPly = startPly || 0; | ||
return IntVal_1.intVal(1 + ((ply + startPly) - 1) / 2); | ||
}; | ||
Chess.plyToColor = function (ply, startPly) { | ||
startPly = startPly || 0; | ||
return (((ply + startPly) % 2) == 1) ? Color_1.Color.White : Color_1.Color.Black; | ||
}; | ||
Chess.turnToPly = function (turn, color) { | ||
color = color || Color_1.Color.White; | ||
var ply = (((turn - 1) * 2) + color + 1); | ||
}; | ||
return Chess; | ||
@@ -492,0 +504,0 @@ }()); |
{ | ||
"name": "onix-chess", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Onix chess library", | ||
@@ -5,0 +5,0 @@ "main": "built/index.js", |
@@ -0,0 +0,0 @@ import { IUser } from 'onix-core/built/app/IUser'; |
@@ -0,0 +0,0 @@ /** |
@@ -593,2 +593,17 @@ import { Hashtable } from 'onix-core/built/Hashtable'; | ||
} | ||
public static plyToTurn(ply: number, startPly?: number) { | ||
startPly = startPly || 0; | ||
return intVal(1 + ((ply + startPly) - 1) / 2); | ||
} | ||
public static plyToColor(ply: number, startPly?: number) { | ||
startPly = startPly || 0; | ||
return (((ply + startPly) % 2) == 1) ? Color.White : Color.Black; | ||
} | ||
public static turnToPly(turn: number, color?: number) { | ||
color = color || Color.White; | ||
let ply = (((turn - 1) * 2) + color + 1); | ||
} | ||
} |
@@ -0,0 +0,0 @@ const WHITE = 0; |
@@ -0,0 +0,0 @@ export interface IOpeningPosition { |
@@ -0,0 +0,0 @@ import { Color } from './Color'; |
@@ -0,0 +0,0 @@ import { Color } from './Color'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
926875
18574