Class BoardState

Hierarchy (view full)

Implements

Constructors

  • Constructs a new board with the given configuration. If height/width are not provided, they will be inferred from the board array, or will default to 19x19 if no board is provided.

    Any state matrices (board, removal, etc..) provided will be cloned and must have the same dimensionality.

    Parameters

    Returns BoardState

Properties

black_prisoners: number
board_is_repeating: boolean
goban_callback?: GobanBase
height: number = 19
removal: boolean[][]
white_prisoners: number
width: number = 19

Methods

  • Returns true if the .board field from the other board is equal to this one

    Parameters

    Returns boolean

  • Computes scoring locations for the board. If area_scoring is true, we will use area scoring rules, otherwise we will use territory scoring rules (which implies omitting territory in seki).

    Parameters

    • area_scoring: boolean

    Returns ScoringLocations

  • Sets a position as being removed or not removed. If emit_stone_removal_updated is set to false, the "stone-removal.updated" event will not be emitted, and it is up to the caller to emit this event appropriately.

    Parameters

    • x: number
    • y: number
    • removed: boolean
    • emit_stone_removal_updated: boolean = true

    Returns void

  • Toggles a group of stones for removal or restoration.

    By default, if we are marking a group for removal but the group is almost certainly alive (two eyes, etc), this will result in a no-op, unless force_removal is set to true.

    Parameters

    • x: number
    • y: number
    • force_removal: boolean = false

    Returns {
        group: RawStoneString;
        removed: boolean;
    }