


Predicate is a function of the following form: (vertex: ) -> board.getConnectedComponent(vertex, predicate) Returns an array of vertices on the board that are exactly Manhattan distance 1 away from the given vertex. Returns the Manhattan distance between the given vertices. Topology Functions board.getDistance(vertex1, vertex2) Returns true if all chains have at least one liberty, otherwise false. Returns true if signMap contains 0 only, otherwise false. Board Property Functions board.isSquare()Įquivalent to board.width = board.height. This function mutates the board and returns this to enable chaining. If mutator is an integer, we will directly set the capture count to mutator instead.
Sabaki go igs update#
We will update the capture count of the player who corresponds to the given sign according to the mutator function. If mutator is a function of the following form (prevCaptures: ) -> Returns the number of stones that the player, who corresponds to the given sign, captured. ko - Specifies if the move would repeat the position that led to boardĬapture Count Functions board.getCaptures(sign).suicide - Specifies if the move would end up in a suicide.capturing - Specifies if the move would capture some enemy stone.overwrite - Specifies if the move would overwrite an occupied stone on the board.pass - Specifies if the move would be a pass ( sign is 0 or vertex is not valid).Returns an object with the following keys with boolean values: board.analyzeMove(sign, vertex)Īnalyzes the hypothetical move that the player who corresponds to the given sign would make at vertex. If preventKo is set to true, this function will throw an error if the attempted move repeats the position that led to board. If preventSuicide is set to true, this function will throw an error if the attempted move is a suicide.

If preventOverwrite is set to true, this function will throw an error if the attempted move is on a vertex that is already occupied by a stone. If sign is 0 or vertex not valid, this function will be equivalent to clone(). If board is valid then the new returned board instance will also be valid. The capture count will also be updated correctly. Returns a new board instance that represents the board state after the player who corresponds to the given sign makes a move at vertex. Returns a boolean whether the given vertex is valid or can be found on the board. Stone Arrangement Functions board.get(vertex) Returns a new Board instance with a sign map of the given dimensions that is filled with 0. denotes the upper left position of the board. an array of the form where x and y are non-negative integers, zero-based coordinates. Example ,īoard positions are represented by a vertex, i.e. 1 denotes a white stone, 1 a black stone, and 0 represents an empty vertex. Each of those subarrays represent one row, all containing the same number of integers.

The board arrangement is represented by an array of arrays. Let move = board.makeMove(1, ) API Sign Map
Sabaki go igs install#
Use npm to install: $ npm install Usage const Board = board = new Board([
