"Rigel" design

 //this is the “node” or “vertex” class that represents a node in the graph (which is the overall maze)

 class MazeCell {

int name;  // this will be the unique name for the node, based on its location in the maze array used by the gui – for example, in a 5 by 5 2D array, the name of the cell in the second row and third column could be 2003, the name of the cell in the 5th row, 8th column could be 5008, etc. 

 boolean wasVisited;

//for searching methods, flag that lets the method know this node was already visited during that particular search
 boolean hasRobot; //true is this current node contains the robot
 boolean hasBeeper; //true if this current node contains a beeper

 boolean Nwall, Swall, Ewall, Wwall;

//true if this node has a wall in any of these directions (Nwall = north wall, etc)


public MazeCell(int row, int column){} //MazeCell constructor

// sets booleans to false, sets wall booleans to true, and names the cell by passing in the row and column number and using the “setName(int, int) method below
public void setWasVisited(boolean bool) \\ wasVisted = bool
public boolean getWasVisited()
public void setHasRobot(boolean bool)
\\ hasRobot = bool
public boolean getHasRobot()
public void setHasBeeper(boolean bool)
\\ hasBeeper = bool
public boolean getHasBeeper()

public voidSetWalls(boolean N, boolean S, boolean E, boolean W){

  // this method used for setting the “presence” of walls around a give cell


public void setName(int rowNumber, int columnNumber){}

// this one sets the name of this given node –if row is 4 and column is 12, then this node’s name would be set to 4012


public int getName(){}

// returns this node’s name. 

 }//end MazeCell class
 class Maze{

 Vector arrayPieces[] //holds the beeper objects

 int gameBoardMaze[][] //just a simple 2D array used for making the “visual” maze
 private MazeCell mazeCellList[] // a list of MazeCells
 private int mazeAdjMatrix[][] //adjacency matrix keeping track of edges

 int allAdjMatricies[] // holds all the small maze mazeAdjMatrix[][]’s

 Maze allSmallMazes[] // holds all the small mazes
 private int numCells //the current number of MazeCells
 private Queue mazeQueue
 public Maze() { //constructor for Maze

  make new gameBoardMaze[][]
  make new mazeCellList of how many nodes (cells) we have
  make a corresponding adjancey matrix
  make a new instance of the queue
 public void addMazeCell(int row, int column){}

 // make a new maze cell, at this particular time, just pass in the spot in the “gameboard or sub-maze” array you are at.  This node will then have a unique name and will not be connected to any other node

 public void addEdge(MazeCell start, MazeCell end){}
 updates the adjacency matrix to reflect an edge between any two mazeCells
 public MazeCell getAdjacentCell(object o){}
 returns a MazeCell (that is not visited yet) that is adjacent to the cell that
 is using this method.  important for search!!!
 public void makeSmallMaze(int rows, int columns){}
 makes a small maze by adding a bunch of mazeCells together - so, first it
 creates the right amount of cells; if 5 and 5 are given as arguments, it will
 make 25 cells and add them to the list of mazeCells.

then, using the gameboard array, it will build a standard maze (using the maze building frontier methods Dave taught in class)– when a frontier cell is chosen, the corresponding node (by name) is updated according to what wall it will lose, and the adjacency matrix is also updated to reflect the new edge created between these two nodes. 


Then, add this small Maze – which is a spanning tree because of the way it was built, to an array of small standard mazes.  Likewise, add the adjacency matrix to an array (or vector) of adjacency matricies.

 public void makeBigMaze(MazeCell subMazes[], int allAdjacencyMatrices []) {
 now, take two submazes at a time (so, you'll just get all the related
 mazeCells - and take their corresponding adjacency matrix, and just update a
 few edges between the two sub-mazes to connect them!  


When merging the smaller mazes, some of the “nodes” or MazeCells will need updated names – another way to handle this it to create another position in the MazeCell int name that holds which submaze it belongs to – this way, all submazes can have cells numbered 1000 to 5005 – or whatever naming scheme we decide on, but then another number can be added to designate what submaze it belongs to like 101000 and 105005 would belong to submaze 1, 201000 and 205005 would belong to submaze 2, etc.

 }//end Maze class
 //to enable the breadth first search of the main maze
 class Queue {
 private object[] queArray;
 private int front;
 private int rear;
 public Queue(int size) { //constructor for queue
   queArray = new int[size]
   front = 0
   rear = -1

 public void insert(object o){}

 //puts an object at rear of queue
 public object remove(){}

 //takes an object from the front of queue
 public boolean isEmpty(){}
 //returns true if queue is empty
 }that's all for queue


// Creates an Object placed to place on Maze

public class Piece extends Observable{
    private Maze maze;
    private Vertex vertex;
    // Constructor. Creates an Object on a Maze (graph)
    // which is on of it vertices
    public Piece(Maze maze, Vertex vertex) {
        this.maze = maze;
        this.vertex = vertex;
    // Set the position of Object on the Maze
    public place (Vertex vtr) {
    // Remove Object from Maze vertex
    public remove (Vertex vrt) {

// Creates object Robot. Searches for

// a beeper Object on  Maze. Computes

// a distance to beeper


public class Robot extends Piece {

    private Maze maze;

    private Vertex vertex;



    // Constructor.    

    Robot(Maze maze, Vertex vertex) {

        super(maze, vertex);

        this.maze = maze;

        this.vertex = vertex;




    // Use Breadth First Search algorithm

    // to search for a MazeCell that contains a Beeper

    // Computes steps nessesary to reach the Beeper

    // returns Vector of vetices that represent direction to

    // a beeper


    public Vector computePath (Object mylocation, Object beeper) {



    // if distance longer then lifetime of the Beeper

    // return true, false otherwise

    public boolean  decideToMove(int distance) {



    // Moves Robot on the Maze (graph) by resetting Robots

    // position on a specific vertex

    public void moveRobot () {






Public class Beeper extends Piece{

            vertex Location; //the x, y location in the maze

            Maze maze;

            Int timeCount;

            Int lifetime; //maximum lifetime (number of steps) of beeper


Public beeper(Maze maze);

Initializes the location of the beeper at a random place in the maze and initializes time count to zero.


public incrementTimeCount()


public getTimeCount()


public remove();

// removes the beeper from the maze


public setLocation()


public getLocation()






Public class BeeperHunt extends Frame {


Board board;

Maze maze;

Button quitButton;



Public static void main(String[] args){

            new BeeperHunt().run();


// Sets all necessary GUI components

     public void setUp (){




Void run:

// creates a Maze and board, adds the board to this frame, makes a robot and initial beepers, and begins the game