Class: Board

Board()

A basic board, the first-step for using the engine

Constructor

new Board()

Source:

Members

gameOver :Boolean

If the game is over
Type:
  • Boolean
Source:

Methods

checkGameOver() → {number|string|null}

Checks if the game is over (tie, win by row, by column or by diagonal). Returns "tie" if there's a tie, the winner or null if the game can continue.
Source:
Returns:
Type
number | string | null

makeMove(player, cell, check)

Makes a move on the board.
Parameters:
Name Type Default Description
player number The player that moves. 0 means O and 1 means X
cell number The cell, cells are numbered from 1-9.
check Boolean true Check at the end of the turn if the game is over (recommended and by default). If not true, then you should check it manually via checkGameOver() at the end of the turn:
Source: