public Board(int newRows, int newColumns, int startRow, int startCol
umn)
Constructor – Passed the size of the board
(numbers of rows and columns) and the starting location for the player (row and column). Must instantiate an array to represent the board and fill it with spaces (EMPTY).
public String toString()
Used to display the board.board is clearly visible. A typical layout might be:
Board
+-+-+-+-+-+-+-+-+-+-+
| | | |$| | | | | | |
+-+-+-+-+-+-+-+-+-+-+
| | | | | | |*| | | |
+-+-+-+-+-+-+-+-+-+-+
| | |$| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+
| | | | |#| | | | | |
+-+-+-+-+-+-+-+-+-+-+
| | | | | |#| |$| | |
+-+-+-+-+-+-+-+-+-+-+
| | | | | | |#| | | |
+-+-+-+-+-+-+-+-+-+-+
where, the * represents the player, $s represent the treasures, and the #s represent the obstacles.
public void playerUp()
If possible, move the player up one square. If the square to be moved to, is occupied, or is off the board, do nothing.
public void playerDown()
If possible, move the player down one square. If the square to be moved to, is occupied, or is off the board, do nothing.