goban-engine
Version:
This contains the built Go engine that is used by the Goban package. There are no display components in this package, only the logic for playing the game of Go, making it suitable for usage in node.js or other server-side environments.
46 lines (45 loc) • 2.02 kB
TypeScript
import type { GobanBase } from "../GobanBase";
import { GobanSelectedThemes } from "./Goban";
export interface GobanCallbacks {
defaultConfig?: () => any;
getCoordinateDisplaySystem?: () => "A1" | "1-1";
isAnalysisDisabled?: (goban: GobanBase, perGameSettingAppliesToNonPlayers: boolean) => boolean;
getClockDrift?: () => number;
getNetworkLatency?: () => number;
getLocation?: () => string;
getShowVariationMoveNumbers?: () => boolean;
getStoneFontScale?: () => number;
getShowUndoRequestIndicator?: () => boolean;
getMoveTreeNumbering?: () => "move-coordinates" | "none" | "move-number";
getCDNReleaseBase?: () => string;
getSoundEnabled?: () => boolean;
getSoundVolume?: () => number;
watchSelectedThemes?: (cb: (themes: GobanSelectedThemes) => void) => {
remove: () => any;
};
getSelectedThemes?: () => GobanSelectedThemes;
customBlackStoneColor?: () => string;
customBlackTextColor?: () => string;
customWhiteStoneColor?: () => string;
customWhiteTextColor?: () => string;
customBoardColor?: () => string;
customBoardLineColor?: () => string;
customBoardUrl?: () => string;
customBlackStoneUrl?: () => string;
customWhiteStoneUrl?: () => string;
canvasAllocationErrorHandler?: (note: string | null, error: Error, extra: {
total_allocations_made: number;
total_pixels_allocated: number;
width?: number | string;
height?: number | string;
}) => void;
addCoordinatesToChatInput?: (coordinates: string) => void;
updateScoreEstimation?: (est_winning_color: "black" | "white", number_of_points: number) => void;
toast?: (message_id: string, duration: number) => void;
}
export declare const callbacks: GobanCallbacks;
/**
* Set's callback functions to be called in various situations. You can set any
* or all of the callbacks, only the provided callbacks will be updated.
*/
export declare function setGobanCallbacks(newCallbacks: GobanCallbacks): void;