cs1705
Class MazeGenerator
java.lang.Object
cs1705.MazeGenerator
public class MazeGenerator
- extends Object
The class generates mazes for Karel J. Robot's world.
You can call generateMaze() to create a maze of the
default size (12x12), and pass the result to
World.startFromString(String). For example, you can place
this line at the start of your RobotTask.task() method:
World.startFromString( MazeGenerator.generateMaze() );
Alternatively, you can use generateMaze(int,int)
to create a maze of any arbitrary size.
- Version:
- 2003.08.20
- Author:
- Peter DePasquale
|
Method Summary |
static String |
generateMaze()
Generates a random maze of the default size (12x12). |
static String |
generateMaze(int width,
int height)
Generates a random maze of the specified size. |
MazeGenerator
public MazeGenerator()
generateMaze
public static String generateMaze()
- Generates a random maze of the default size (12x12).
The result is suitable for initializing Karel J. Robot's
World using World.startFromString(String).
- Returns:
- the robot world description containing the maze
generateMaze
public static String generateMaze(int width,
int height)
- Generates a random maze of the specified size.
The result is suitable for initializing Karel J. Robot's
World using World.startFromString(String).
- Parameters:
height - the desired height of the mazewidth - the desired width of the maze
- Returns:
- the robot world description containing the maze