# TDD Kata (3): TaTeTíTomek

##### Problem

Tic-Tac-Toe-Tomek is a game played on a 4 x 4 square board. The board starts empty, except that a single ‘T’ symbol may appear in one of the 16 squares. There are two players: X and O. They take turns to make moves, with X starting. In each move a player puts her symbol in one of the empty squares. Player X’s symbol is ‘X’, and player O’s symbol is ‘O’.

After a player’s move, if there is a row, column or a diagonal containing 4 of that player’s symbols, or containing 3 of her symbols and the ‘T’ symbol, she wins and the game ends. Otherwise the game continues with the other player’s move. If all of the fields are filled with symbols and nobody won, the game ends in a draw. See the sample input for examples of various winning positions.

Given a 4 x 4 board description containing ‘X’, ‘O’, ‘T’ and ‘.’ characters (where ‘.’ represents an empty square), describing the current state of a game, determine the status of the Tic-Tac-Toe-Tomek game going on. The statuses to choose from are:

• “X won” (the game is over, and X won)
• “O won” (the game is over, and O won)
• “Draw” (the game is over, and it ended in a draw)
• “Game has not completed” (the game is not over yet)

If there are empty cells, and the game is not over, you should output “Game has not completed”, even if the outcome of the game is inevitable.

Se nos da un archivo de entrada con distintas posiciones de tablero, y tenemos que producir una salida diciendo si X ganó, O ganó, empate, o todavía falta completar el juego.

Lo resolví usando TDD, y pueden ver el resultado en:

https://github.com/ajlopez/TddOnTheRocks/tree/master/TicTacToeTomek

Y la historia, prácticamente con commits por tests, en:

https://github.com/ajlopez/TddOnTheRocks/commits/master/TicTacToeTomek

Fue un ejercicio sencillo, y bien adaptado para TDD. Google me aceptó tanto la solución de un archivo de entrada pequeño, y de otro grande. Tengo que escribir sobre los otros ejercicios (B, C, D), que se complican por: