-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
70 lines (68 loc) · 1.52 KB
/
Copy pathtest.cpp
File metadata and controls
70 lines (68 loc) · 1.52 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
/*Cesar Vargas
*AI Fall 2010
*test.cpp
*/
#include "Astar.h"
#include "Square.h"
// #include "Queue.h"
#include "Node.h"
// #include "SearchAlg.h"
// #include <iostream>
// #include <string>
#include <sstream>
Square start;
Square goal;
int counter=0;
int array[4];
// using namespace std;
void parse(Square &in, string a);
void prompt(Square &st, Square &go);
int main(){
prompt(start,goal);
return 0;
}
void parse(Square &in, string a){
counter++;
int sentinel=1;
int temp;
for(istringstream i(a); i>>temp; ){
array[sentinel] = temp;
sentinel++;
}
in.set_row(array,counter);
}
void prompt(Square &st, Square &go){
string input;
string choice;
cout << "Do you want to play a game: (Y or N)";
getline(cin,choice);
while( choice == "Y" ){
cout << "Enter a 3x3 square with space as separator, this is your star node:" <<endl;
getline(cin,input);
parse(st,input);
getline(cin,input);
parse(st,input);
getline(cin,input);
parse(st,input);
cout << "here is your beginning puzzle" << endl;
start.print();
counter=0;
cout << "Enter a 3x3 square with space as separator, this is your end node:" <<endl;
getline(cin,input);
parse(go,input);
getline(cin,input);
parse(go,input);
getline(cin,input);
parse(go,input);
cout << "here is your goal puzzle" << endl;
go.print();
counter=0;
Astar test1(start,goal);
test1.begin();
cout << "Do you want to play again:(Y or N)";
getline(cin,choice);
}
}
void expand(){
start.find_zero();
}