UNPKG

goban

Version:

[![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/online-go/goban)

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;