Klasse Maze


public class Maze extends VisualizationElement
Represents a maze to visualize.
  • Felddetails

    • CELL_WIDTH

      private static final int CELL_WIDTH
      Siehe auch:
    • CELL_HEIGTH

      private static final int CELL_HEIGTH
      Siehe auch:
    • START_X_POS

      private static final int START_X_POS
      Siehe auch:
    • START_Y_POS

      private static final int START_Y_POS
      Siehe auch:
    • maze

      private Cell[][] maze
    • currentCell

      private Cell currentCell
    • heigth

      private int heigth
    • width

      private int width
    • xpos

      private int xpos
    • ypos

      private int ypos
    • cellStack

      private Stack<Cell> cellStack
  • Konstruktordetails

    • Maze

      public Maze(int heigth, int width)
      Creates a new Maze.
      Parameter:
      heigth - Height of the Maze.
      width - Width of the Maze.
  • Methodendetails

    • draw

      public void draw(Graphics g)
      Beschreibung aus Klasse kopiert: VisualizationElement
      Draws the visualization element.
      Angegeben von:
      draw in Klasse VisualizationElement
      Parameter:
      g - The Graphics object to draw the element to the DrawArea.
    • setMaze

      public void setMaze(Cell[][] maze)
      Parameter:
      maze - the maze to set
    • getMaze

      public Cell[][] getMaze()
      Gibt zurück:
      the maze
    • setHeigth

      public void setHeigth(int heigth)
      Parameter:
      heigth - the heigth to set
    • getHeigth

      public int getHeigth()
      Gibt zurück:
      the heigth
    • setWidth

      public void setWidth(int width)
      Parameter:
      width - the width to set
    • getWidth

      public int getWidth()
      Gibt zurück:
      the width
    • initMaze

      private void initMaze()
      Initializes the maze.
    • initMazeWithAllWalls

      private void initMazeWithAllWalls()
      Initializes a Maze full of walls.
    • generateWays

      private void generateWays()
      Generates ways through a maze full of walls.
    • removeCellsSouthWall

      private void removeCellsSouthWall(int column, int row)
      Removes a cell's south wall.
      Parameter:
      column - Column of the cell.
      row - Row of the cell.
    • removeCellsNorthWall

      private void removeCellsNorthWall(int column, int row)
      Removes a cell's north wall.
      Parameter:
      column - Column of the cell.
      row - Row of the cell.
    • removeCellsEastWall

      private void removeCellsEastWall(int column, int row)
      Removes a cell's east wall.
      Parameter:
      column - Column of the cell.
      row - Row of the cell.
    • removeCellsWestWall

      private void removeCellsWestWall(int column, int row)
      Removes a cell's west wall.
      Parameter:
      column - Column of the cell.
      row - Row of the cell.
    • removeWallBetweenCurrentCellAndNeighbour

      private void removeWallBetweenCurrentCellAndNeighbour(Cell cell, Cell neighbor)
      Removes the wall between two cells.
      Parameter:
      cell - Cell to remove a wall.
      neighbor - The Cell's neighbour to remove the corresponding wall.
    • getUnvisitedCellNeighbors

      private Vector<Cell> getUnvisitedCellNeighbors(Cell currentCell)
      Gets all unvisited neighbors of a cell.
      Parameter:
      currentCell - The cell to get the neighbors.
      Gibt zurück:
      The cell's unvisited neighbors.
    • getAllCellNeighbours

      private Vector<Cell> getAllCellNeighbours(Cell currentCell)
      Gets all neighbors of a cell.
      Parameter:
      currentCell - The cell to get the neighbors.
      Gibt zurück:
      The cell's neighbors.