import java.util.ArrayList; class GameBoard { int width, height; ArrayList> board; GameBoard(int w, int h) { this.width = w; this.height = h; this.board = new ArrayList>(); for (int r=0; r aRow = new ArrayList(); // Make a new row for (int c=0; c objects) { // Erase the stuff at the old player and ball locations for(GameObject obj: objects) { if (obj instanceof MovableObject) { MovableObject m = (MovableObject)obj; if ((m.previousLocation.y >= 0) && (m.previousLocation.y < height) && (m.previousLocation.x >= 0) && (m.previousLocation.x < width)) this.board.get(m.previousLocation.y).set(m.previousLocation.x, ' '); } } // Draw the game objects on the board now for(GameObject obj: objects) { if (obj instanceof Wall) { Wall w = (Wall)obj; for (int i=0; i= 0) && (obj.location.y < height) && (obj.location.x >= 0) && (obj.location.x < width)) this.board.get(obj.location.y).set(obj.location.x, obj.getAppearance()); } } // Now display it for (int r=0; r aRow = this.board.get(r); for (int c=0; c