#include <iostream>
+#include <sstream>
+#include <fstream>
using namespace std;
+#include "planner.h"
+#include "action.h"
+
+vector<string> stringToVector(string str){
+ vector<string> strings;
+
+ istringstream ist(str);
+ while (ist >> str){
+ strings.push_back(str);
+ }
+
+ return strings;
+}
+
int main(int argc, char** argv){
+
+ if (argc != 4){
+ cout << "Syntax: " << argv[0] << " <file> \"init state\" \"goal state\"" << endl;
+ return 1;
+ }
+
+ ifstream file(argv[1]);
+ if (!file){
+ cerr << "Cannot open input file: " << argv[1] << endl;
+ exit(2);
+ }
+ vector<Action> actions;
+ while (!file.eof()){
+ string exec;
+ string precond;
+ string effects;
+ getline(file,exec);
+ getline(file,effects);
+ getline(file,precond);
+ cout << exec << ":" << effects << ":" << precond << endl;
+ actions.push_back(Action(exec, stringToVector(precond), stringToVector(effects)));
+ }
+ Planner p(actions, stringToVector(argv[2]), stringToVector(argv[3]));
return 0;
}