-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
49 lines (48 loc) · 1.57 KB
/
main.cpp
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
38
39
40
41
42
43
44
45
46
47
48
49
#include <asm-generic/errno.h>
#include <bits/types/struct_tm.h>
#include <clocale>
#include <cstdlib>
#include <iostream>
#include <string>
#include "dijstra_algorithm.h"
#include "astar_algorithm.h"
#include "gbfs_algorithm.h"
#include "bfs_algorithm.h"
#include "map_config.h"
#include "mnode.h"
#include "map.h"
using std::cout;
using std::string;
int main(int argc, char* argv[])
{
setlocale(LC_ALL, "");
Map tMap(41, 81);
cout<<"map size="<<tMap.Size();
tMap.DrawMap();
MNode startNode(3, 9);
MNode endNode(10, 0);
startNode.NTypeSetter(ENodeType::START);
startNode.NStateSetter(ENodeState::NONE);
endNode.NTypeSetter(ENodeType::END);
endNode.NStateSetter(ENodeState::NONE);
tMap.Draw(startNode, EDrawType::TYPE);
tMap.Draw(endNode, EDrawType::TYPE);
tMap.DrawTerrain(MapConfig::TerrainMap);
// BFSAlgorithm bfs(tMap, startNode, endNode);
// DIJAlgorithm dij(tMap, startNode, endNode);
// GBFSAlgorithm gbfs(tMap, startNode, endNode);
AStarAlgorithm asa(tMap, startNode, endNode);
// map<int, int> bfsSolveMap = bfs.Resolve();
// map<int, int> dijSolveMap = dij.Resolve();
// map<int, int> gbfsSolveMap = gbfs.Resolve();
map<int, int> asaSolveMap = asa.Resolve();
refresh();
// tMap.DrawFinalPath(bfs.FindPath(bfsSolveMap), startNode, endNode);
// tMap.DrawFinalPath(dij.FindPath(dijSolveMap), startNode, endNode);
// tMap.DrawFinalPath(gbfs.FindPath(gbfsSolveMap), startNode, endNode);
tMap.DrawFinalPath(asa.FindPath(asaSolveMap), startNode, endNode);
refresh();
getch();
tMap.ClearMap();
return EXIT_SUCCESS;
}