Class TestGoban

This is a minimal implementation of Goban, primarily used for unit tests.

Hierarchy (view full)

Constructors

Properties

__board_redraw_pen_layer_timer __clock_timer? __draw_state __last_pt __update_move_tree analysis_move_counter analysis_removal_last_position analysis_removal_state? bounded_height bounded_width bounds chat_log circle_radius clock_should_be_paused_for_move_submission colored_circles? conditional_path conditional_starting_color conditional_tree config connectToReviewSent? current_cmove? currently_my_cmove dirty_redraw disconnectedFromGame display_width? done_loading_review dont_draw_last_move double_click_submit draw_bottom_labels draw_left_labels draw_right_labels draw_top_labels edit_color? engine errorHandler game_id game_type getPuzzlePlacementSetting? goban_id heatmap? height highlight_movetree_moves interactive isInPushedAnalysis isPlayerController isPlayerOwner label_character label_mark last_clock? last_emitted_clock? last_hover_square? last_move? last_move_radius last_paused_by_player_state last_paused_state last_phase? last_review_message last_sound_played_for_a_stone_placement? last_stone_sound leavePushedAnalysis marked_analysis_score? move_selected? no_display onError? on_game_screen one_click_submit original_square_size parent pause_control? paused_since? pen_marks player_id preloaded_data? previous_mode puzzle_autoplace_delay restrict_moves_to_movetree review_had_gamedata review_id scoring_mode sendLatencyTimer? sent_timed_out_message shift_key_is_down show_variation_move_numbers showing_scores socket socket_event_bindings square_size stalling_score_estimate? stone_font_scale stone_placement_enabled stone_removal_auto_scoring_done? variation_stone_opacity width THEMES THEMES_SORTED setCallbacks setTranslations

Accessors

Methods

_socket_on acceptRemovedStones acceptUndo annul cancelGame cancelUndo clearAnalysisDrawing clearAnalysisScores clearMark clearMessage clearPendingResignation clearTransientMark computeMetrics computeNewPlayerClock connect debouncedEmitCapturedStones decodeMoves decodePrettyCoordinates defaultConfig deleteBranch deleteConditionalPath deleteCustomMark destroy disableDrawing disablePen disableStonePlacement disconnect drawPenMarks drawSquare editPlaceByPrettyCoordinates enableDrawing enablePen enableStonePlacement encodeMove encodeMoves followConditionalPath followConditionalSegment getAnalysisScoreColorAtLocation getClockDrift getCoordinateDisplaySystem getCurrentConditionalPath getLastReviewMessage getLocation getMarks getNetworkLatency getPlayerRelativeLatency getSelectedThemes getShowUndoRequestIndicator getShowVariationMoveNumbers getStoneFontScale getWidthForSquareSize giveReviewControl hideScores incrementLabelCharacter isAnalysisDisabled isCurrentUserAPlayer isLastOfficialMove jumpToLastOfficialMove load markAnalysisScores markDirty move_tree_redraw nextSibling onAnalysisScoringMove onAnalysisScoringStart onAnalysisToggleStoneRemoval pass pauseGame performStoneRemovalAutoScoring placeByPrettyCoordinates playMovementSound post_config_constructor prettyCoordinates prevSibling putAnalysisRemovalAtLocation putAnalysisScoreColorAtLocation putOrClearLabel redraw rejectRemovedStones requestUndo resign resumeGame saveConditionalMoves scheduleRedrawPenLayer sendChat sendMove sendPendingResignation sendPreventEscaping sendPreventStalling sendTimedOut set setAnalyzeTool setBounds setColoredCircles setColoredMarks setConditionalTree setCustomMark setEditColor setForRemoval setGameClock setHeatmap setLabelCharacter setLabelCharacterFromMarks setLabelPosition setLastOfficialMove setLastReviewMessage setLetterMark setMark setMarkByPrettyCoordinates setMarkColor setMarks setMode setModeDeferred setMoveTreeContainer setScoringMode setSquareSize setSquareSizeBasedOnDisplayWidth setState setStoneFontScale setStrictSekiMode setSubmit setSubscriptMark setTheme setTitle setToPreviousMode setTransientMark showFirst showMessage showNext showPrevious showScores showStallingScoreEstimate syncReviewMove toggleMark updateMoveTree updateOrRedrawMoveTree updatePlayerToMoveTitle updateScoreEstimation updateTitleAndStonePlacement xy2ij getCDNReleaseBase getMoveTreeNumbering getSoundEnabled getSoundVolume

Constructors

Properties

__board_redraw_pen_layer_timer: any = null
__clock_timer?: Timeout
__draw_state: string[][]
__last_pt: {
    i: number;
    j: number;
    valid: boolean;
} = ...

Type declaration

  • i: number
  • j: number
  • valid: boolean
__update_move_tree: any = null
analysis_move_counter: number
analysis_removal_last_position: {
    i: number;
    j: number;
} = ...

Type declaration

  • i: number
  • j: number
analysis_removal_state?: boolean
bounded_height: number
bounded_width: number
bounds: GobanBounds
chat_log: GobanChatLog = []
circle_radius: number
clock_should_be_paused_for_move_submission: boolean = false
colored_circles?: (undefined | ColoredCircle)[][]
conditional_path: string = ""
conditional_starting_color: "black" | "white" | "invalid" = "invalid"
conditional_tree: ConditionalMoveTree = ...
config: GobanConfig
connectToReviewSent?: boolean
current_cmove?: ConditionalMoveTree
currently_my_cmove: boolean = false
dirty_redraw: any = null
disconnectedFromGame: boolean = true
display_width?: number
done_loading_review: boolean = false
dont_draw_last_move: boolean
double_click_submit: boolean
draw_bottom_labels: boolean
draw_left_labels: boolean
draw_right_labels: boolean
draw_top_labels: boolean
edit_color?: "black" | "white"
engine: GobanEngine
errorHandler: ((e) => void)

Type declaration

    • (e): void
    • Parameters

      • e: Error

      Returns void

game_id: number
game_type: string
getPuzzlePlacementSetting?: (() => PuzzlePlacementSetting)
goban_id: number = ++last_goban_id

Base fields *

heatmap?: NumberMatrix
height: number
highlight_movetree_moves: boolean
interactive: boolean
isInPushedAnalysis: (() => boolean)

Type declaration

    • (): boolean
    • Returns boolean

isPlayerController: (() => boolean)

Type declaration

    • (): boolean
    • Returns boolean

isPlayerOwner: (() => boolean)

Type declaration

    • (): boolean
    • Returns boolean

label_character: string
label_mark: string = "[UNSET]"
last_clock?: AdHocClock
last_emitted_clock?: JGOFClockWithTransmitting
last_hover_square?: JGOFIntersection
last_move?: MoveTree
last_move_radius: number
last_paused_by_player_state: null | boolean = null
last_paused_state: null | boolean = null
last_phase?: GobanEnginePhase
last_review_message: ReviewMessage
last_sound_played_for_a_stone_placement?: string
last_stone_sound: number
leavePushedAnalysis: (() => void)

Type declaration

    • (): void
    • Returns void

marked_analysis_score?: boolean[][]
move_selected?: JGOFIntersection
no_display: boolean
onError?: ((error) => void)

Type declaration

    • (error): void
    • Parameters

      • error: Error

      Returns void

on_game_screen: boolean
one_click_submit: boolean
original_square_size: number | ((goban) => number) | "auto"

Type declaration

    • (goban): number
    • Parameters

      Returns number

parent: HTMLElement
pause_control?: AdHocPauseControl
paused_since?: number
pen_marks: any[]
player_id: number
preloaded_data?: GobanConfig
previous_mode: string
puzzle_autoplace_delay: number
restrict_moves_to_movetree: boolean
review_had_gamedata: boolean
review_id: number
scoring_mode: boolean | "stalling-scoring-mode"
sendLatencyTimer?: Timeout
sent_timed_out_message: boolean = false
shift_key_is_down: boolean
show_variation_move_numbers: boolean
showing_scores: boolean = false
socket_event_bindings: [keyof GobanSocketEvents, (() => void)][] = []
square_size: number = 10
stalling_score_estimate?: StallingScoreEstimate
stone_font_scale: number
stone_placement_enabled: boolean
stone_removal_auto_scoring_done?: boolean = false
variation_stone_opacity: number
width: number
THEMES: ThemesInterface = THEMES
THEMES_SORTED: {
    black: GobanTheme[];
    board: GobanTheme[];
    white: GobanTheme[];
    [key: string]: GobanTheme[];
} = THEMES_SORTED

Type declaration

setCallbacks: ((newCallbacks) => void) = setGobanCallbacks

Type declaration

    • (newCallbacks): void
    • Set's callback functions to be called in various situations. You can set any or all of the callbacks, only the provided callbacks will be updated.

      Parameters

      Returns void

setTranslations: ((_catalog, _debug_mode?) => void) = setGobanTranslations

Type declaration

    • (_catalog, _debug_mode?): void
    • Parameters

      Returns void

Accessors

  • get analyze_subtool(): string
  • Returns string

  • set analyze_subtool(analyze_subtool): void
  • Parameters

    • analyze_subtool: string

    Returns void

  • get destroyed(): boolean
  • Returns boolean

  • get is_game_record(): boolean
  • True if the game is a game record of a real life game

    Returns boolean

  • get review_controller_id(): undefined | number
  • Returns undefined | number

  • set review_controller_id(review_controller_id): void
  • Parameters

    • review_controller_id: undefined | number

    Returns void

  • get review_owner_id(): undefined | number
  • Returns undefined | number

  • set review_owner_id(review_owner_id): void
  • Parameters

    • review_owner_id: undefined | number

    Returns void

  • get submit_move(): undefined | (() => void)
  • Returns undefined | (() => void)

  • set submit_move(submit_move): void
  • Parameters

    • submit_move: undefined | (() => void)

    Returns void

Methods

  • 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

  • Marks scores on the board when in analysis mode. Note: this will not clear existing scores, this is intentional as I think it's the expected behavior of reviewers

    Returns void

  • Goban calls some abstract methods as part of the construction process. Because our subclasses might (and do) need to do some of their own config before these are called, we set this function to be called by our subclass after it's done it's own internal config stuff.

    Returns GobanEngine

  • When we think our clock has runout, send a message to the server letting it know. Otherwise we have to wait for the server grace period to expire for it to time us out.

    Returns void

  • Parameters

    • colored_marks: {
          [key: string]: {
              color: string;
              move: string;
          };
      }
      • [key: string]: {
            color: string;
            move: string;
        }
        • color: string
        • move: string

    Returns void

  • Called when a location is marked or unmarked for removal

    Parameters

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

    Returns void

  • This is a callback that gets called by GobanEngine.getState to save and board state as it pushes and pops state. Our renderers can override this to save state they need.

    Parameters

    • marks: {
          [mark: string]: string;
      }
      • [mark: string]: string
    • Optional dont_draw: boolean

    Returns void

  • Parameters

    • msg_id: MessageID
    • Optional parameters: {
          [key: string]: any;
      }
      • [key: string]: any
    • Optional timeout: number

    Returns void

  • Parameters

    • x: number
    • y: number
    • mark: string | number
    • Optional force_label: boolean
    • Optional force_put: boolean

    Returns boolean

  • Parameters

    • x: number
    • y: number
    • anti_slip: boolean = true

    Returns {
        i: number;
        j: number;
        valid: boolean;
    }

    • i: number
    • j: number
    • valid: boolean