kokopu
Version:
A JavaScript/TypeScript library implementing the chess game rules and providing tools to read/write the standard chess file formats.
52 lines (51 loc) • 2.83 kB
TypeScript
/*!
* -------------------------------------------------------------------------- *
* *
* Kokopu - A JavaScript/TypeScript chess library. *
* <https://www.npmjs.com/package/kokopu> *
* Copyright (C) 2018-2025 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/>. *
* *
* -------------------------------------------------------------------------- */
import { PositionImpl } from './impl';
/**
* Options for the {@link Position.ascii()} method.
*/
export interface PositionAsciiOptions {
/**
* If true, the board is represented from Black's point of view. false by default.
*/
flipped?: boolean;
/**
* If provided, each line of the ASCII-art picture is prefixed with this string.
*/
prefix?: string;
/**
* Whether board coordinates should be present or not. false by default.
*/
coordinateVisible?: boolean;
}
/**
* Return a human-readable string representing the position. This string is multi-line,
* and is intended to be displayed in a fixed-width font (similarly to an ASCII-art picture).
*/
export declare function ascii(position: PositionImpl, { flipped, prefix, coordinateVisible }: PositionAsciiOptions): string;
export declare function getFEN(position: PositionImpl, fiftyMoveClock?: number, fullMoveNumber?: number, regularFENIfPossible?: boolean): string;
export declare function parseFEN(variant: number, fen: string, strict: boolean): {
position: PositionImpl;
fiftyMoveClock: number;
fullMoveNumber: number;
};