Class GobanEngine

Hierarchy (view full)

Constructors

Properties

Accessors

Methods

Constructors

Properties

_cur_move: MoveTree
_cur_review_move: undefined | MoveTree
_last_official_move: MoveTree
_outcome: string = ""
_phase: GobanEnginePhase = "play"
_rules: GobanEngineRules = "japanese"
_strict_seki_mode: boolean = false
_undo_requested?: number
_winner?: number | "black" | "white"
aga_handicap_scoring: boolean = false
allow_ko: boolean = false
allow_self_capture: boolean = false
allow_superko: boolean = false
automatic_stone_removal: boolean = false
black_prisoners: number
board_is_repeating: boolean
decoded_moves: JGOFMove[] = []
disable_analysis: boolean = false
dontStoreBoardHistory: boolean
free_handicap_placement: boolean = false
game_id: number = NaN
goban_callback?: GobanBase
group_ids?: number[]
handicap: number = NaN
handicap_rank_difference?: number
height: number = 19
initial_state: GobanEngineInitialState = ...
is_game_record: boolean = false
komi: number = NaN
latencies?: {
    [player_id: string]: number;
}

Type declaration

  • [player_id: string]: number
loading_sgf: boolean = false
move_before_jump?: MoveTree
move_tree: MoveTree
move_tree_layout_dirty: boolean = false
move_tree_layout_hash: {
    [coords: string]: MoveTree;
} = {}

Type declaration

move_tree_layout_vector: number[] = []
name: string = ""
needs_sealing?: JGOFSealingIntersection[]
parentEventEmitter?: EventEmitter<GobanEvents, any>
player_pool: {
    [id: number]: GobanEnginePlayerEntry;
}

Type declaration

players: {
    black: GobanEnginePlayerEntry;
    white: GobanEnginePlayerEntry;
} = ...

Type declaration

puzzle_collection: number = NaN
puzzle_description: string = "[missing puzzle description]"
puzzle_opponent_move_mode: PuzzleOpponentMoveMode = "manual"
puzzle_player_move_mode: PuzzlePlayerMoveMode = "free"
puzzle_rank: number = NaN
puzzle_type: string = "[missing puzzle type]"
removal: boolean[][]
rengo?: boolean
rengo_casual_mode: boolean
rengo_teams?: {
    [colour: string]: GobanEnginePlayerEntry[];
}

Type declaration

review_id?: number
score_handicap: boolean = false
score_prisoners: boolean = false
score_stones: boolean = false
score_territory: boolean = false
score_territory_in_seki: boolean = false
stalling_score_estimate?: StallingScoreEstimate
superko_algorithm: GobanEngineSuperKoAlgorithm = "psk"
territory_included_in_sgf: boolean = false
throw_all_errors?: boolean
time_control: JGOFTimeControl = ...
white_prisoners: number
width: number = 19

Accessors

  • get winner(): undefined | number | "black" | "white"
  • Returns undefined | number | "black" | "white"

  • set winner(winner): void
  • Parameters

    • winner: undefined | number | "black" | "white"

    Returns void

Methods

  • Returns {
        black: string;
        white: string;
    }

    • black: string
    • white: string
  • Computes the score of the current board state.

    If only_prisoners is true, we return the same data structure for convenience, but only the prisoners will be counted, other sources of points will be zero.

    Parameters

    • Optional only_prisoners: boolean

    Returns Score

  • Decodes a move string like "A11" into a move object like {x: 0, y: 10}. Also handles the special cases like ".." and "pass" which map to {x: -1, y: -1}.

    Parameters

    • coordinates: string

    Returns JGOFMove

  • Parameters

    • from_turn: number
    • moves: string | AdHocPackedMove
    • Optional cb: ((x, y, edited, color) => void)
        • (x, y, edited, color): void
        • Parameters

          • x: number
          • y: number
          • edited: boolean
          • color: number

          Returns void

    Returns MoveTree[]

  • Returns a move string from the given official move number (aka branch point)

    Returns {
        from: number;
        moves: string;
    }

    • from: number
    • moves: string
  • returns true if our current move is our last official move

    Returns boolean

  • Returns the number of stones removed. If you want the coordinates of the stones removed, pass in a removed_stones array to append the moves to.

    Parameters

    • x: number
    • y: number
    • Optional checkForKo: boolean
    • Optional errorOnSuperKo: boolean
    • Optional dontCheckForSuperKo: boolean
    • Optional dontCheckForSelfCapture: boolean
    • Optional isTrunkMove: boolean
    • Optional removed_stones: JGOFIntersection[]

    Returns number

  • Parameters

    • Optional player_id: number

    Returns "black" | "white" | "invalid"

  • Encodes an x,y pair or a move object like {x: 0, y: 0} into a move string like "A1"

    Parameters

    Returns string

  • Parameters

    • x: number
    • y: number

    Returns string

  • Parameters

    • x: number
    • y: number
    • Optional needs_sealing: boolean

    Returns void

  • 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;
    }