Create a Tic-Tac-Toe game that is played between two players on a n by n board.
The rules are as follows:
Assuming n = 3, and player A uses "X" while player B uses "O":
TicTac toeGame = new TicTac(3);
toeGame.play(0, 0, 1); -> Returns 0 (no winner yet)
|X| | |
| | | | // Player 1 marks position (0, 0)
| | | |
toeGame.play(0, 2, 2); -> Returns 0 (no winner yet)
|X| |O|
| | | | // Player 2 marks position (0, 2)
| | | |
toeGame.play(2, 2, 1); -> Returns 0 (no winner yet)
|X| |O|
| | | | // Player 1 marks position (2, 2)
| | |X|
toeGame.play(1, 1, 2); -> Returns 0 (no winner yet)
|X| |O|
| |O| | // Player 2 marks position (1, 1)
| | |X|
toeGame.play(2, 0, 1); -> Returns 0 (no winner yet)
|X| |O|
| |O| | // Player 1 marks position (2, 0)
|X| |X|
toeGame.play(1, 0, 2); -> Returns 0 (no winner yet)
|X| |O|
|O|O| | // Player 2 marks position (1, 0)
|X| |X|
toeGame.play(2, 1, 1); -> Returns 1 (player 1 wins)
|X| |O|
|O|O| | // Player 1 marks position (2, 1)
|X|X|X|