Requirement 4 – the game's output

A few outputs should be added to let the players know the current status of the game.

We want feedback when either an event or an error occurs within the game. The output shows the status of the board after every move.

No output channel is specified. To make it easier, we decided to use the system standard output to print an event when it occurs. A few lines have been added on every action to let the user know about the status of the game:

... private static final String DELIMITER = "|"; private void switchPlayer() { if (Color.RED == currentPlayer) { currentPlayer = Color.GREEN; } else { currentPlayer = Color.RED; } System.out.println("Current turn: " + currentPlayer); } public void printBoard() { for (int ...

Get Test-Driven Java Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.