UNPKG

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.

25 lines (24 loc) 1.01 kB
import { JGOFNumericPlayerColor } from "../formats"; /** * This is intended to be an "easy to understand" method of generating a unique id * for a board position. * * The "id" is the list of all the positions of the stones, black first then white, * separated by a colon. * * There are in fact 8 possible ways to list the positions (all the rotations and * reflections of the position). The id is the lowest (alpha-numerically) of these. * * Colour independence for the position is achieved by takeing the lexically lower * of the ids of the position with black and white reversed. * * The "easy to understand" part is that the id can be compared visually to the * board position * * The downside is that the id string can be moderately long for boards with lots of stones */ export type BoardTransform = (x: number, y: number) => { x: number; y: number; }; export declare function positionId(position: Array<Array<JGOFNumericPlayerColor>>, height: number, width: number): string;