Application Kata „Tic Tac Toe“

Implement a console application fort wo players playing [Tic Tac Toe].

By running the program a new game is started. It is displayed like the following:

A B C
0 | |
-+-+-
1 | |
-+-+-
2 | |
Command:

The players move alternately by entering the coordinate of a field where they will place their token as a command [1] for example „A0“ or „C2“. The symbol for player 1 is „X“ and for player 2 it is „O“.

If a player tries to place the token on a field that is filled already the game board is displayed again without any changes and the player can try again.

The game board is displayed after each move. If player 1 moves to A0 and player 2 moves to B1 the game board looks like the following:

A B C
0X| |
-+-+-
1 |O|
-+-+-
2 | |
Command:

Entering “new” as a command starts a new game.

By entering „exit“ one can quit the program.

The game is over if no more moves are possible or one player won the game. A message will be displayed like the following:

A B C
0X| |
-+-+-
1X|O|O
-+-+-
2X| |
*** Player 1 wins
Command:

If the game is over only the commands „new“ and „exit“ are accepted.

Resources
[Tic Tac Toe] https://en.wikipedia.org/wiki/Tic-tac-toe

Endnotes
[1]The commands should be understood without considering upper or lower case.

Level of difficulty

Code Kata Categroies