Problem Statement | |||||||||||||
You are working on a text-based checkers program, and you need to write a module to display the state of the board to the user. The board has 8 rows labeled 1 to 8 from top to bottom, and 8 columns labeled A to H from left to right. The cells alternate colors black and white, and no two horizontally or vertically adjacent cells can have the same color. Cell A1 is black. Each piece on the board is either black or white, depending on the player who owns it. You want to draw the board by printing 8 rows of 8 characters where each character is one of the following:
B.B.B.B. .B.B.B.B B.B.B.B. .#.#.#.# #.#.#.#. .W.W.W.W W.W.W.W. .W.W.W.W You are given a String[] pieces where each element describes the color and position of one piece on the board. Each element is formatted "<COLOR> <C><R>", where <COLOR> is either "WHITE" or "BLACK", <C> is the column ('A'-'H'), and <R> is the row ('1'-'8') (all quotes for clarity). Return a String[] containing exactly 8 elements, where the first element is the text representation of row 1, the second element is row 2, and so on. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | Even though in a regular checkers game pieces are never placed on the white cells, your playing program may contain bugs so you want to print the pieces that landed up on the white cells too. | ||||||||||||
- | Similarly you might get more than the usual 12 each of white or black pieces. | ||||||||||||
Constraints | |||||||||||||
- | pieces will contain between 0 and 50 elements, inclusive. | ||||||||||||
- | Each element of pieces will be formatted as described in the problem statement. | ||||||||||||
- | No two pieces will be on the same cell. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
|