Options
All
  • Public
  • Public/Protected
  • All
Menu

Class State

Hierarchy

  • State

Index

Properties

config

config: any

cur_board

cur_board: any

cur_player_ind

cur_player_ind: any

grid

grid: any

history

history: any

player_ids

player_ids: any

turns

turns: any

winner

winner: any

Accessors

cur_player

  • get cur_player(): any

Methods

checkMoveValid

  • checkMoveValid(move: [number, number]): void
  • checks if move is valid

    throws

    enums.error if game is already over

    throws

    enums.locked if that sub-board is locked and hence cannot be placed in

    throws

    enums.occupied if that square is occupied

    Parameters

    • move: [number, number]

      move by current player

    Returns void

checkWin

  • checkWin(board: any): 0 | 1 | -1
  • checks win for any board without updating the board

    Parameters

    • board: any

      the board to check

    Returns 0 | 1 | -1

oD2D

  • oD2D(n: any): { x: number; y: number }
  • converts 1D "coord" to 2D coord

    Parameters

    • n: any

    Returns { x: number; y: number }

    • x: number
    • y: number

place

  • place(move: [number, number]): void
  • checks if move is valid, places the move, checks for sub-board wins, and then updates board

    throws

    enums.error if game is already over

    throws

    enums.locked if that sub-board is locked and hence cannot be placed in

    throws

    enums.occupied if that square is occupied

    Parameters

    • move: [number, number]

      move by current player

    Returns void

tD1D

  • tD1D(coord: any): any
  • converts 2D coord to 1D "coord"

    Parameters

    • coord: any

    Returns any

updateWins

  • updateWins(ind: number): void
  • checks for wins in sub-boards then the larger board as a whole then updates

    Parameters

    • ind: number

      which sub-board was placed in, hence which sub-board to check

    Returns void

Generated using TypeDoc