src/demo/Maze.java
public void initMaze() {
        boolean initialized = false;
        for (Cell[] cells : maze) {
            for (Cell cell : cells) {
                cell.visitCount = 0;
            }
        }
        int x = size / 2;
        int y = size / 2;
        mazeAgentHistory.clear();
        while (!initialized) {
            if (maze[x][y].isOpen()) {
                MazeAgent mazeAgent = new MazeAgent(x, y, -1);
                mazeAgentCurrent = mazeAgent;
                maze[x][y].updateCellTimeStep(++timeStep);
                maze[x][y].incrementCount();
                mazeAgentHistory.addLast(mazeAgent);
                initialized = true;
            }
            x = random.nextInt(size);
            y = random.nextInt(size);
        }
        updateState();
    }
/**
     * Initializes maze with given size. Positions agent to the middle of maze.
     *
     */
Initializes maze with given size. Positions agent to the middle of maze.
Initializes maze with given size . Positions agent to the middle of maze .
public void initMaze() {
        boolean initialized = false;
        for (Cell[] cells : maze) {
            for (Cell cell : cells) {
                cell.visitCount = 0;
            }
        }
        int x = size / 2;
        int y = size / 2;
        mazeAgentHistory.clear();
        while (!initialized) {
            if (maze[x][y].isOpen()) {
                MazeAgent mazeAgent = new MazeAgent(x, y, -1);
                mazeAgentCurrent = mazeAgent;
                maze[x][y].updateCellTimeStep(++timeStep);
                maze[x][y].incrementCount();
                mazeAgentHistory.addLast(mazeAgent);
                initialized = true;
            }
            x = random.nextInt(size);
            y = random.nextInt(size);
        }
        updateState();
    }
public void initMaze ( ) { boolean initialized = false ; for ( Cell [ ] cells : maze ) { for ( Cell cell : cells ) { cell . visitCount = 0 ; } } int x = size / 2 ; int y = size / 2 ; mazeAgentHistory . clear ( ) ; while ( ! initialized ) { if ( maze [ x ] [ y ] . isOpen ( ) ) { MazeAgent mazeAgent = new MazeAgent ( x , y , - 1 ) ; mazeAgentCurrent = mazeAgent ; maze [ x ] [ y ] . updateCellTimeStep ( ++ timeStep ) ; maze [ x ] [ y ] . incrementCount ( ) ; mazeAgentHistory . addLast ( mazeAgent ) ; initialized = true ; } x = random . nextInt ( size ) ; y = random . nextInt ( size ) ; } updateState ( ) ; }
Initializes maze with given size.
Initializes maze with given size .