23 lines
762 B
C++
23 lines
762 B
C++
#include "Grid.h"
|
|
#include "algorithms/Sidewinder.h"
|
|
#include "algorithms/BinaryTree.h"
|
|
|
|
//Simple demo of Dijkstra's algorithm on a maze
|
|
int main() {
|
|
std::cout << "Binary Tree" << std::endl;
|
|
DistanceGrid grid(15, 15);
|
|
Sidewinder::on(grid);
|
|
grid.setStart(grid.getCellRef(0, 0));
|
|
std::cout << grid << std::endl;
|
|
grid.distances = grid.distances.pathTo(grid.getCellRef(0, grid.getRows() - 1));
|
|
std::cout << grid << std::endl;
|
|
|
|
std::cout << "Sidewinder" << std::endl;
|
|
DistanceGrid grid2(15, 15);
|
|
BinaryTree::on(grid2);
|
|
grid2.setStart(grid2.getCellRef(0, 0));
|
|
std::cout << grid2 << std::endl;
|
|
grid2.distances = grid2.distances.pathTo(grid2.getCellRef(0, grid2.getRows() - 1));
|
|
std::cout << grid2 << std::endl;
|
|
}
|