cmsc433.p3
Class SkippingMazeSolver

java.lang.Object
  extended by cmsc433.p3.MazeSolver
      extended by cmsc433.p3.SkippingMazeSolver
Direct Known Subclasses:
STMazeSolverBFS, STMazeSolverDFS

public abstract class SkippingMazeSolver
extends MazeSolver

Superclass of solvers that only branch at choice points.


Nested Class Summary
 class SkippingMazeSolver.SolutionFound
           
 
Constructor Summary
SkippingMazeSolver(Maze maze)
           
 
Method Summary
 Choice firstChoice(Position pos)
          Returns the first choice point reached from the given position.
 Choice follow(Position at, Direction dir)
          Follows a path until a choice point.
 Choice followMark(Position at, Direction dir, int color)
          Follows a path until a choice point.
 void markPath(java.util.List<Direction> path, int color)
          Marks a path
 java.util.List<Direction> pathToFullPath(java.util.List<Direction> path)
           
 
Methods inherited from class cmsc433.p3.MazeSolver
solve
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SkippingMazeSolver

public SkippingMazeSolver(Maze maze)
Method Detail

firstChoice

public Choice firstChoice(Position pos)
                   throws SkippingMazeSolver.SolutionFound
Returns the first choice point reached from the given position.

Throws:
SkippingMazeSolver.SolutionFound

follow

public Choice follow(Position at,
                     Direction dir)
              throws SkippingMazeSolver.SolutionFound
Follows a path until a choice point. Returns the choice encountered. /* If a deadend is encountered, returns a Choice object whose 'at' field is the location of the dead end and whose 'choices' list is empty.

Parameters:
at - The position to start from.
dir - The direction to proceed in.
Throws:
SkippingMazeSolver.SolutionFound

followMark

public Choice followMark(Position at,
                         Direction dir,
                         int color)
                  throws SkippingMazeSolver.SolutionFound
Follows a path until a choice point. Marks cells along the way with the specified color.

Parameters:
at - The position to start from.
dir - The direction to proceed in.
color - The color to mark with.
Throws:
SkippingMazeSolver.SolutionFound

markPath

public void markPath(java.util.List<Direction> path,
                     int color)
Marks a path

Parameters:
path -
color -
Throws:
SkippingMazeSolver.SolutionFound

pathToFullPath

public java.util.List<Direction> pathToFullPath(java.util.List<Direction> path)