Holds the state of the game board as a two dimensional array each element of the inner array is a SubBoard
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.
The state board is a typical 3x3 TTT board that holds the "state" of the big game so if a cell of the big game has been won, it will be 0 or 1 on this state board. This is very useful to easily see "the big picture" in the game.
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.
Return a new UTTT board 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 sub-boards in the main board
Returns true if the game is over
Validates a board selection before playing it
Board coordinates as an array [row, col]
true if the board is playable
Returns a string with the board formatted for display including new lines.
Printable version of the game board
Generated using TypeDoc
Ultimate Tic Tac Toe Class
This holds a full game, with all the associated state, and exposes several methods to interact with it.
All methods that modify the state have been implemented as a functional/immutable API, which means that they return a modified game, but don't change the original one. This has been done to make tree searching easier, since your root nodes at each step won't be accidentally modified.