Stateless tic tac toe engine that provides a set of pure functions. You give the current board and additional arguments (if necessary) and get something back.
It's up to you to maintain the state of the board, the starting state should be Array(9).fill(null)
.
Returns true if its X (player 1) turn, else false.
Returns true if square can be set, else its already set (or win has occured) so return false.
Returns true if all squares has been set, else false.
Returns a new array of the state of the board after setting a symbol ('X' or 'O') at the given index.
Returns the string symbol of the winner or null
if no winner exists.