Data Structures and Algorithms

Order Description

Welcome to your first assignment. The problem statement for the assignment is long, but therequirements are specified in detail. Develop your solution class-by-class, module-by-module,testing at every stage.For this assignment, you will write a series of programs to simulate a simple board game. Mostboard games have a variety of pieces that move across the game board according to a set rulesabout how far and in which direction they may move (think chess). After defining a series ofpieces, you will set up the infrastructure for a board game and demonstrate its operation.Start by defining a Piece class with the following fields: Name: A String (eg. ‘Jedi’, ‘Droid’, etc.) Colour: A String (eg. ‘Black’, ‘Red’, etc.) Position: A point described by a pair of integers (eg. [2, 4], [1, 1], etc.).Assume that the game board is an 8 X 8 grid. The position is a coordinate ([x, y]) on theboard, with the values of x and y each taking a value between 0 and 7. The top left cornerof the board is taken to be the origin ([0, 0]). You can define Position in a separate classor use classes from the Java standard library if you wish.Implement the following methods: Constructor: A constructor that creates a Piece object with the given name, colour andposition. Getters and Setters: Appropriate methods to set, change and access fields. toString(): A method to display the Piece Object’s fields.Next define a SlowPiece class – A Piece that moves left or right exactly one step per move. YourSlowPiece should extend the Piece class, implementing a constructor and redefining the inheritedtoString method via overriding.In addition, implement the following method: move (String direction): A method to move the piece left or right by one space. Thismethod will accept a direction parameter. If a move is requested that would take the Pieceoff the edge of the board, simply return without doing anything.Define a FastPiece class – A Piece that moves left or right a specified, arbitrary number of stepsper move. Your FastPiece should extend the Piece class, implementing a constructor andredefining the inherited toString method via overriding.In addition, implement the following method: move (String direction, int n): A method to move the piece left or right by aspecified number of spaces. This method will accept a direction parameter and a numberof spaces. If a move is requested that would take the Piece off the edge of the board,simply return without doing anything.