Question: In Java: Create: A Coordinate class with an int row, an int column, and a char representing the value of the coordinate (this week, you
In Java:
Create:
A Coordinate class with an int row, an int column, and a char representing the value of the coordinate (this week, you will use four values for the Coordinates: blank (' ') for an empty space, W for a wall, S for the starting point, and E for the exit.) Provide getters and setters.
A StreetMap class with a two-dimensional array of Coordinates but no GUI code.
A JavaFX GUI class called MazeGUIPane. Since the constructor for Scene takes a Pane as a parameter, this class should extend one of the Pane classes, most likely BorderPane. It should also contain a GridPane with a two-dimensional grid of Labels. One label in the GridPane corresponds to one Coordinate in the StreetMap. Note this important distinction: the MazeGUIPane is for the the user interface while the StreetMap is for data.
The outer edges of the grid should consist of walls, except for one starting square and one exit square. When the game starts, squares that are not on the edges should be randomly set to wall and space squares (use about 20% walls.) Note that this does not guarantee that it is possible to escape the bulls at all; that is why you need to be able to toggle between walls and spaces.
Clicking on a label that is not on the edge of the board toggles the label between wall and empty space. The event handling code must update the StreetMap when the squares toggle. It must also change the css class of the Label in order to change its appearance.
You will also need a game reset button. You do not need to make the button work yet. In my solution, this button is in an HBox contained in the MazeGUIPane.
You may use this GUI as a model if you like, but feel free to create a different one:
Map of Pamplona Run Map of Pamplona RunStep by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
