public class BoardPrinter extends java.lang.Object implements GameListener
Boards on the console. This
class can also be used as a GameListener; it will cause the board to be
printed whenever the board changes.| Constructor and Description |
|---|
BoardPrinter() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clear()
Clear the console.
|
void |
gameChanged(Game g)
Print the current board and an indication of whether the game is over
and, if it is, whether it is a draw and who the winner is.
|
static void |
printBoard(Board b)
Print the board.
|
public static void clear()
public static void printBoard(Board b)
0 1 2 3 4
+---+---+---+---+---+
0 | | | | | |
+---+---+---+---+---+
1 | | X | O | | |
+---+---+---+---+---+
2 | | | X | | |
+---+---+---+---+---+
public void gameChanged(Game g)
gameChanged in interface GameListener