-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
37 lines (29 loc) · 761 Bytes
/
Copy pathmain.cpp
File metadata and controls
37 lines (29 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include "MazeGen.h"
#include "aStar.h"
constexpr int GRID_SIZE = 10;
int main(int argc, char* argv[]) {
/*** set grid size **/
int gridSize;
// check arguments for gridsize
if (argc == 2) {
try {
gridSize = std::stoi(argv[1]) / 2;
}
catch (std::exception& e) {
std::cerr << "Usage: ./Maze <gridSize>" << std::endl;
return 1;
}
}
else
gridSize = GRID_SIZE / 2 - 1;
// generate maze
MazeGen maze(gridSize /* OPTIONAL SEED */);
maze.generateMaze();
auto v = maze.getGrid();
// path finding
AStar astar(v);
astar.setLivePrintSpeed(50);
astar.find({0, 0}, {2* gridSize, 2*gridSize}, true);
return 0;
}