import { Color } from './index'; export type WdlModel = "sf" | "sf16" | "sf15.1" | "sf15" | "sf14" | "sf12" | "lichess"; /** * A relative :class:`~chess.engine.Score` and the point of view. */ export declare class PovScore { /** The relative :class:`~chess.engine.Score`. */ relative: Score; /** The point of view (``chess.WHITE`` or ``chess.BLACK``). */ turn: Color; constructor(relative: Score, turn: Color); /** * Gets the score from White's point of view. */ white(): Score; /** * Gets the score from Black's point of view. */ black(): Score; /** * Gets the score from the point of view of the given *color*. */ pov(color: Color): Score; /** * Tests if this is a mate score. */ isMate(): boolean; /** * See :func:`~chess.engine.Score.wdl()`. */ wdl({ model, ply, }?: { model?: WdlModel; ply?: number; }): PovWdl; toRepr(): string; toString: () => string; equals(other: object): boolean; } /** * Evaluation of a position. * * The score can be :class:`~chess.engine.Cp` (centi-pawns), * :class:`~chess.engine.Mate` or :py:data:`~chess.engine.MateGiven`. * A positive value indicates an advantage. * * There is a total order defined on centi-pawn and mate scores. * * >>> from chess.engine import Cp, Mate, MateGiven * >>> * >>> Mate(-0) < Mate(-1) < Cp(-50) < Cp(200) < Mate(4) < Mate(1) < MateGiven * true * * Scores can be negated to change the point of view: * * >>> -Cp(20) * Cp(-20) * * >>> -Mate(-4) * Mate(+4) * * >>> -Mate(0) * MateGiven */ export declare abstract class Score { abstract score(): number | null; abstract score({ mateScore }: { mateScore: number; }): number; abstract score({ mateScore }: { mateScore: null; }): number | null; /** * Returns the centi-pawn score as an integer or ``null``. * * You can optionally pass a large value to convert mate scores to * centi-pawn scores. * * >>> Cp(-300).score() * -300 * >>> Mate(5).score() is null * true * >>> Mate(5).score(mateScore=100000) * 99995 */ abstract score({ mateScore }: { mateScore?: number | null; }): number | null; /** * Returns the number of plies to mate, negative if we are getting * mated, or ``null``. * * .. warning:: * This conflates ``Mate(0)`` (we lost) and ``MateGiven`` * (we won) to ``0``. */ abstract mate(): number | null; /** * Tests if this is a mate score. */ isMate(): boolean; /** * Returns statistics for the expected outcome of this game, based on * a *model*, given that this score is reached at *ply*. * * Scores have a total order, but it makes little sense to compute * the difference between two scores. For example, going from * ``Cp(-100)`` to ``Cp(+100)`` is much more significant than going * from ``Cp(+300)`` to ``Cp(+500)``. It is better to compute differences * of the expectation values for the outcome of the game (based on winning * chances and drawing chances). * * >>> Cp(100).wdl().expectation() - Cp(-100).wdl().expectation() // doctest: +ELLIPSIS * 0.379... * * >>> Cp(500).wdl().expectation() - Cp(300).wdl().expectation() // doctest: +ELLIPSIS * 0.015... * * :param model: * * ``sf``, the WDL model used by the latest Stockfish * (currently ``sf16``). * * ``sf16``, the WDL model used by Stockfish 16. * * ``sf15.1``, the WDL model used by Stockfish 15.1. * * ``sf15``, the WDL model used by Stockfish 15. * * ``sf14``, the WDL model used by Stockfish 14. * * ``sf12``, the WDL model used by Stockfish 12. * * ``lichess``, the win rate model used by Lichess. * Does not use *ply*, and does not consider drawing chances. * :param ply: The number of half-moves played since the starting * position. Models may scale scores slightly differently based on * this. Defaults to middle game. */ abstract wdl({ model, ply }: { model?: WdlModel; ply?: number; }): Wdl; abstract neg(): Score; abstract pos(): Score; abstract abs(): Score; _scoreTuple(): [boolean, boolean, boolean, number, number | null]; equals(other: object): boolean; lt(other: object): boolean; le(other: object): boolean; gt(other: object): boolean; ge(other: object): boolean; } export declare const _sf16Wins: (cp: number, { ply }: { ply: number; }) => number; export declare const _sf151Wins: (cp: number, { ply }: { ply: number; }) => number; export declare const _sf15Wins: (cp: number, { ply }: { ply: number; }) => number; export declare const _sf14Wins: (cp: number, { ply }: { ply: number; }) => number; export declare const _sf12Wins: (cp: number, { ply }: { ply: number; }) => number; export declare const _lichessRawWins: (cp: number) => number; /** * Centi-pawn score. */ export declare class Cp extends Score { cp: number; constructor(cp: number); mate(): null; score({ mateScore }?: { mateScore?: number | null; }): number; wdl({ model, ply, }?: { model?: WdlModel; ply?: number; }): Wdl; toString(): string; toRepr(): string; neg(): Cp; pos(): Cp; abs(): Cp; } /** * Mate score. */ export declare class Mate extends Score { moves: number; constructor(moves: number); mate(): number; score(): number | null; score({ mateScore }: { mateScore: number; }): number; score({ mateScore }: { mateScore?: number | null; }): number | null; wdl({ model, ply, }?: { model?: WdlModel; ply?: number; }): Wdl; toString(): string; toRepr(): string; neg(): MateGivenType | Mate; pos(): Mate; abs(): MateGivenType | Mate; } /** * Winning mate score, equivalent to ``-Mate(0)``. */ export declare class MateGivenType extends Score { mate(): number; score(): number | null; score({ mateScore }: { mateScore: number; }): number; score({ mateScore }: { mateScore?: number | null; }): number | null; wdl({ model, ply, }?: { model?: WdlModel; ply?: number; }): Wdl; neg(): Mate; pos(): MateGivenType; abs(): MateGivenType; toRepr(): string; toString(): string; } export declare const MateGiven: MateGivenType; /** * Relative :class:`win/draw/loss statistics ` and the point * of view. * * .. deprecated:: 1.2 * Behaves like a tuple * ``(wdl.relative.wins, wdl.relative.draws, wdl.relative.losses)`` * for backwards compatibility. But it is recommended to use the provided * fields and methods instead. */ export declare class PovWdl { /** The relative :class:`~chess.engine.Wdl`. */ relative: Wdl; /** The point of view (``chess.WHITE`` or ``chess.BLACK``). */ turn: Color; constructor(relative: Wdl, turn: Color); /** * Gets the :class:`~chess.engine.Wdl` from White's point of view. */ white(): Wdl; /** * Gets the :class:`~chess.engine.Wdl` from Black's point of view. */ black(): Wdl; /** * Gets the :class:`~chess.engine.Wdl` from the point of view of the given * *color*. */ pov(color: Color): Wdl; bool(): boolean; toRepr(): string; iter(): IterableIterator; len(): number; getitem(idx: number): number; equals(other: object): boolean; } /** * Win/draw/loss statistics. */ export declare class Wdl { /** The number of wins. */ wins: number; /** The number of draws. */ draws: number; /** The number of losses. */ losses: number; constructor(wins: number, draws: number, losses: number); /** * Returns the total number of games. Usually, ``wdl`` reported by engines * is scaled to 1000 games. */ total(): number; /** * Returns the relative frequency of wins. */ winningChance(): number; /** * Returns the relative frequency of draws. */ drawingChance(): number; /** * Returns the relative frequency of losses. */ losingChance(): number; /** * Returns the expectation value, where a win is valued 1, a draw is * valued 0.5, and a loss is valued 0. */ expectation(): number; bool(): boolean; iter(): IterableIterator; reversed(): IterableIterator; pos(): Wdl; neg(): Wdl; } declare const _default: { PovScore: typeof PovScore; Score: typeof Score; _sf16Wins: (cp: number, { ply }: { ply: number; }) => number; _sf151Wins: (cp: number, { ply }: { ply: number; }) => number; _sf15Wins: (cp: number, { ply }: { ply: number; }) => number; _sf14Wins: (cp: number, { ply }: { ply: number; }) => number; _sf12Wins: (cp: number, { ply }: { ply: number; }) => number; _lichessRawWins: (cp: number) => number; Cp: typeof Cp; Mate: typeof Mate; MateGivenType: typeof MateGivenType; MateGiven: MateGivenType; PovWdl: typeof PovWdl; Wdl: typeof Wdl; }; export default _default; //# sourceMappingURL=engine.d.ts.map