maze.filler
Class MazeFillerKinked

java.lang.Object
  extended bymaze.filler.MazeFiller
      extended bymaze.filler.MazeFillerRetry
          extended bymaze.filler.MazeFillerKinked

public class MazeFillerKinked
extends MazeFillerRetry

A MazeFiller which retries and will turn.


Field Summary
 
Fields inherited from class maze.filler.MazeFiller
branch, theOpenEnds, theRNG
 
Constructor Summary
MazeFillerKinked()
          Constructs a new MazeFillerKinked.
MazeFillerKinked(PushPop p)
          Constructs a new MazeFillerKinked with the given PushPop; either a Stack or a Queue.
MazeFillerKinked(PushPop p, double b)
          Constructs a new MazeFillerKinked with the given PushPop (either a Stack or a Queue) and a given branching factor between 0.0 and 1.0.
 
Method Summary
protected  void branch(Maze m, Coordinate c, int d)
          Creates a branching (3-exit) Cell in a Maze.
protected  void straight(Maze m, Coordinate c, int d)
          Creates a straight-through (2-exit) Cell in a Maze.
 
Methods inherited from class maze.filler.MazeFillerRetry
finish, start
 
Methods inherited from class maze.filler.MazeFiller
next
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MazeFillerKinked

public MazeFillerKinked()
Constructs a new MazeFillerKinked. Uses a LIFO and 0.50 branching factor.


MazeFillerKinked

public MazeFillerKinked(PushPop p)
Constructs a new MazeFillerKinked with the given PushPop; either a Stack or a Queue. The branching factor is 0.50.

Parameters:
p - PushPop to use, either Stack or Queue.

MazeFillerKinked

public MazeFillerKinked(PushPop p,
                        double b)
Constructs a new MazeFillerKinked with the given PushPop (either a Stack or a Queue) and a given branching factor between 0.0 and 1.0.

Parameters:
p - PushPop to use, either Stack or Queue.
b - double branching factor between 0.0 and 1.0.
Method Detail

straight

protected void straight(Maze m,
                        Coordinate c,
                        int d)
Creates a straight-through (2-exit) Cell in a Maze.

Overrides:
straight in class MazeFiller
Parameters:
m - Maze in which the Cell is constructed.
c - Coordinate for the Cell.
d - int direction for the straight-through path.

branch

protected void branch(Maze m,
                      Coordinate c,
                      int d)
Creates a branching (3-exit) Cell in a Maze. One exit is given by the end of the path; the other direction parameter establishes a second exit, the third exit is chosen at random.

Overrides:
branch in class MazeFiller
Parameters:
m - Maze in which the Cell is constructed.
c - Coordinate for the Cell.
d - int direction for the straight-through path.