kokopu
Version:
A JavaScript/TypeScript library implementing the chess game rules and providing tools to read/write the standard chess file formats.
50 lines (49 loc) • 2.73 kB
TypeScript
/*!
* -------------------------------------------------------------------------- *
* *
* Kokopu - A JavaScript/TypeScript chess library. *
* <https://www.npmjs.com/package/kokopu> *
* Copyright (C) 2018-2026 Yoann Le Montagner <yo35 -at- melix.net> *
* *
* Kokopu is free software: you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
* as published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version. *
* *
* Kokopu is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General *
* Public License along with this program. If not, see *
* <http://www.gnu.org/licenses/>. *
* *
* -------------------------------------------------------------------------- */
/**
* Internal structure in `Position`, that encodes the state of the corresponding chess position.
*/
export interface PositionImpl {
board: number[];
turn: number;
castling: number[];
enPassant: number;
variant: number;
legal: boolean | null;
king: number[];
effectiveCastling: number[] | null;
effectiveEnPassant: number | null;
}
export declare function hasCanonicalStartPosition(variant: number): boolean;
export declare function makeEmpty(variant: number): PositionImpl;
/**
* @param variant - Must be a variant with a canonical start position.
*/
export declare function makeInitial(variant: number): PositionImpl;
/**
* Chess960 initial position, following the numbering scheme proposed by Reinhard Scharnagl (see for instance https://chess960.net/start-positions/).
*
* @param scharnaglCode - Integer between 0 and 959 inclusive.
*/
export declare function make960FromScharnagl(scharnaglCode: number): PositionImpl;
export declare function makeCopy(position: PositionImpl): PositionImpl;