-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cpp
104 lines (81 loc) · 2.48 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
using namespace std;
#include <iostream>
#include "constants.hpp"
#include "class/Slider/Slider.hpp"
#include "class/SliderGraph/SliderGraph.hpp"
void showMenu()
{
cout << "-------------------------------------------------------------\n";
cout << "- TP de Grafos - solucionador do N-puzzle -\n";
cout << "-------------------------------------------------------------\n";
cout << "-Selecione uma opção:\n";
cout << "1 - Mostrar slider em memória;\n";
cout << "2 - Criar slider aleatório;\n";
cout << "3 - Ler de um arquivo;\n";
cout << "4 - Achar o melhor caminho por busca em largura;\n";
cout << "5 - Achar o melhor caminho por busca em profundidade;\n";
cout << "9 - Sair\n";
cout << "-------------------------------------------------------------\n";
}
void reShowMenu()
{
cout << "--- Digite 0 para mostrar o menu novamente -------------------\n";
}
int main(int argc, char const *argv[])
{
SliderGraph * _sliderGraph = new SliderGraph();
int option;
string filename;
showMenu();
while (true)
{
cin >> option;
if(option==0)
{
showMenu();
}
else if(option==1)
{
cout << _sliderGraph->toString();
}
else if(option==2)
{
_sliderGraph = new SliderGraph();
cout << "Slider gerado!\n";
cout << _sliderGraph->toString();
}
else if (option==3)
{
cout << "Digite o nome do arquivo. Ele deve estar na pasta input correta!\n";
cin >> filename;
_sliderGraph = new SliderGraph(filename);
cout << "Slider gerado!\n";
cout << _sliderGraph->toString();
}
else if (option==4)
{
if(!_sliderGraph->isSolvable()) {
cout << "Slider sem solucao!\n";
} else {
cout << _sliderGraph->widhtSearch();
_sliderGraph->trimTree();
}
}
else if (option==5)
{
if(!_sliderGraph->isSolvable()) {
cout << "Slider sem solucao!\n";
} else {
cout << _sliderGraph->depthSearch();
_sliderGraph->trimTree();
}
}
else if (option==9)
{
cout << "Obrigado!!\n";
return 0;
}
reShowMenu();
}
return 0;
}