Play a game (Tic-Tac-Toe)

Now the input is moves: <X|O <row <col (1 to 3), X first, turns alternating. Print <player - <row <col for a valid move. Errors, in this order: invalid move: bad input, invalid move: game over, invalid move: not your turn, invalid move: out of bounds, invalid move: cell taken (an invalid move does not change whose turn it is). At the end print the board and the status as in stage 1.

Input: One move per line.

Output: One line per move, then the board and status.

Difficulty: Easy. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • Keep the board as 9 cells and whose turn it is.

More Tic-Tac-Toe practice