forked from EmaroLab/endor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
79 lines (68 loc) · 2.35 KB
/
main.cpp
File metadata and controls
79 lines (68 loc) · 2.35 KB
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
//===============================================================================//
// Name : main.cpp
// Author(s) : Yeshasvi Tirupachuri V.S., Barbara Bruno
// Affiliation : University of Genova, Italy - dept. DIBRIS
// Version : 1.0
// Description : Main program using the AND-OR graph library
//===============================================================================//
#include <iostream>
#include "aograph.h"
using namespace std;
// display basic information about the usage of ENDOR
void displayHelp()
{
cout<<"To use ENDOR, follow these steps:" <<endl;
cout<<"1. create a graph description (e.g., myGraph.txt)" <<endl;
cout<<" according to the template in assemblies/TEMPLATE.txt" <<endl;
cout<<"2. load the graph in ENDOR (L + myGraph.txt)" <<endl;
cout<<"3. set the nodes as solved one by one (S + [nodeName])" <<endl;
cout<<"4. exit ENDOR (E)" <<endl;
}
int main(int argc, char **argv)
{
char c;
char c_strategy;
string fileName;
string nodeName;
// create an empty graph
string name = "DEFAULT";
AOgraph oneGraph(name);
cout<<endl <<"ENDOR tool for AND-OR graphs creation and navigation. Enjoy!" <<endl;
do
{
cout<<endl;
cout<<"Available commands:" <<endl;
cout<<"H - display the ENDOR help" <<endl;
cout<<"L - load a graph description from file" <<endl;
cout<<"N - ask for a suggestion on the node to solve" <<endl;
cout<<"S - set a node as solved" <<endl;
cout<<"E - exit the program" <<endl;
cout<<"Selected command: ";
cin>>c;
cout<<endl;
switch(c)
{
case 'H':
displayHelp();
break;
case 'L':
cout<<"Graph configuration: ";
cin>>fileName;
oneGraph.loadFromFile(fileName);
break;
case 'N':
cout<<"[Y/N] Use long-sighted (optimal path) strategy? ";
cin>>c_strategy;
oneGraph.suggestNext(c_strategy == 'Y');
break;
case 'S':
cout<<"Solved node name: ";
cin>>nodeName;
oneGraph.solveByName(nodeName);
break;
case 'E':
return 1;
}
}while (c != 'E');
return 1;
}