Question
Phase 1: The board First, implement the abstract class Tile. This class represents the elements of the two-dimensional array that is the board (a Tile[][]
Phase 1: The board First, implement the abstract class Tile. This class represents the elements of the two-dimensional array that is the board (a Tile[][] array). The tiles will hold the game pieces or a wall. We will add more to this class later. To start, a Tile should have: Two instance variables: a String which is the symbol that should be displayed by this tile,and a boolean which will indicate if this tile is a tile that the player can move onto (is passable). A constructor that has two parameters the String and the boolean, in that order. Method String getSymbol()which fetches the symbol that should be displayed. Method boolean isPassable() which indicates if the tile is passable.
Now implement two subclasses of the Tile class: Wall, and OpenSpace.
Class Wall is not passable, and the symbol is a hash:#
Class OpenSpace is an empty space which is passable, and the symbol is a period: .
These subclasses will only contain constructors. All the other logic in them is inherited from class Tile.
You can test your classes using the supplied test program TestPhase1.java. You should get the output shown below. ####
#..#
#..#
####
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started