//create the cells for the maze void Maze::createMaze() { stack<Cell*> cells; cells.push(getCell(rand()%getRows(), rand()%getCols())); while (!cells.empty()) { Cell* c1; c1 = cells.top(); cells.pop(); c1->setVisited(); vector<direction> neighbors; getUnvisitedNeighbors(c1, neighbors); if (!neighbors.empty()) { cells.push(c1); int i = rand()%neighbors.size(); connect(c1, neighbors.at(i)); cells.push(getCell(c1->getRow() + Direction::row(neighbors.at(i)), c1->getCol() + Direction::col(neighbors.at(i)))); } } setStartCell(getCell(0, rand() % getCols())); setEndCell(getCell(getRows()-1, rand() % getCols())); startCell = getStartCell(); endCell = getEndCell(); }
void TriangularMaze::removeWalls() { CellMaze::removeWalls(); getStartCell().getRightMostVerticalOuterWall()->m_visible = false; getEndCell().getLeftMostVerticalOuterWall()->m_visible = false; }