Question: This is my Tile class below public abstract class Tile { public String symbol; public boolean passable; private Content tile; public Tile(String symbol, boolean passable){

 This is my Tile class below public abstract class Tile {

This is my Tile class below

public abstract class Tile { public String symbol; public boolean passable; private Content tile; public Tile(String symbol, boolean passable){ this.symbol = symbol; this.passable = passable; } public Tile(String symbol, boolean passable, Content tile){ this.symbol = symbol; this.passable = passable; this.tile = tile; } public String getSymbol(){ if(tile != null){ return tile.getSymbol(); } else{ return symbol; } } public boolean isPassable(){ if(passable = true){ } return passable; }

}

Create a Gameboard class that will hold and manage a 2D array of tiles that will represent the game state To initialize the game board, data will be read in from a text file. The text file has the following format. The first row contains two integers that specify how many rows and columns are in the rectangular game board. The rest of the file gives the initial state of the game board. It has the same format as the output that we have been generating to this point: "Y" is the amulet, ""is the player, and so on. The Gameboard class, for this phase, only needs instance variable of type Tile00 Write a constructor that accepts a file name as a parameter (a String). Open that file, read the contents, and initialize your two dimensional array of tiles based on the file. It can be assumed that the file will be in the same folder as your code. Write a toString0 method that returns the game board as a multi-line String. The first line should give the current health of the player, and the remaining lines should show the board. See the examples below n test your class with TestPhase4.java. You should get the output shown below. Make sure the supplied test data files (phase4GameBoard1.txt and phase4GameBoard2.txt) are in the same folder as the rest of your files. Health: 100 #Ah@.TW #.h..h# Health: 100

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!