Question: Please help, I am stuck on 2, and 3. Code has to be in java. Class Knight is similar to class Application. import java.util.*; public

Please help, I am stuck on 2, and 3. Code has to be in java.

Please help, I am stuck on 2, and 3. Code has to

Class Knight is similar to class Application.

import java.util.*; public interface Application { /** * Determines if a given position is legal and not a dead end. * * @param pos - the given position. * * @return true if pos is a legal position and not a dead end. */ boolean isOK (Position pos); /** * Indicates that a given position is possibly on a path to a goal. * * @param pos the position that has been marked as possibly being on a * path to a goal. */ void markAsPossible (Position pos); /** * Indicates whether a given position is a goal position. * * @param pos the position that may or may not be a goal position. * * @return true if pos is a goal position; false otherwise. */ boolean isGoal (Position pos); /** * Indicates that a given position is not on any path to a goal position. * * @param pos the position that has been marked as not being on any path to * a goal position. */ void markAsDeadEnd (Position pos); /** * Converts this Application object into a String object. * * @return the String representation of this Application object. */ String toString(); /** * Produces an Iterator object that starts at a given position. * * @param pos the position the Iterator object starts at. * * @return an Iterator object that accesses the positions directly * available from pos. */ Iterator iterator (Position pos); } // interface Application

/10 a. 1. Creation of project3. 2. Defined Knight class Class implements interface Application b. Has constructor with 3 parameters: x, y (grid size) & starting cell. c. Has method getStart: returns start position d. Has method getGrid: returns state of tour.. Has method isOK: postion is legal. f. Has method isGoal: reached end of tour g. Has method markAsPossible: possible move toward goal h. Has method markAs DeadEnd: retract move i. Has method toString e. /5 15 15 15 15 15 /5 15 15 3. Has inner class KnightIterator a. Has constructor with one parameter (position) b. Has method hasNext.... c. Has method next: looks at next move of the "knight" /5 /5

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!