Holds the state of the game board as a two dimensional array each element of the inner array is a Cell
Holds the maximum number of moves before the board is full this is here to avoid recalculating it every time its needed
Counter of moves that have been played so far
Holds the coordinates of the board that should be played next If the last move sends you to a finished board, then this will be null and you may choose any.
Indicates the size of Ultimate TTT we're dealing with typically this will be 3 for a 3x3 board.
Game winner, will be null if no one has won yet, -1 in a tie, 0 if player 1 won or 1 if player 2 won.
Game winner, will be null if no one has won yet, -1 in a tie, 0 if player 1 won or 1 if player 2 won.
Check if a given column has been won
Column index
Check if the left to right diagonal has been won
Check if a given row has been won
Row index
Check if the right to left diagonal has been won
Return a new SubBoard as a copy of this one
Copy of the current game
Getter for moves
Returns the winner for the game, throws an exception if the game hasn't finished yet.
-1 for a tie, 0 you won, 1 opponent won
Get a list of all the valid moves in the board
Returns true if the game is over, undefined if it hasn't finished yet
Same as isFinished()
Validates a given move (check for right format, data ranges, and that the move hasn't already been played)
Move coordinates as an array [x, y]
true if the move is valid
Validates a player
Player identifier (0 || 1)
Execute a move. This is an immutable method, that returns a new SubBoard. It may be easier and more clear to use the addOpponentMove and addMyMove methods instead.
Player identifier (0 || 1)
Move coordinates as an array [x, y]
which turn this was (to enable replaying UTTT games)
Updated copy of the current game with the move added and the state updated
Returns a string with the board formatted for display including new lines.
Generated using TypeDoc
SubBoard for TicTacToe games This class implements the traditional game of TicTacToe