forked from holderlb/wumpus-world-simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Agent.cc
58 lines (45 loc) · 724 Bytes
/
Agent.cc
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
// Agent.cc
#include <iostream>
#include "Agent.h"
using namespace std;
Agent::Agent ()
{
}
Agent::~Agent ()
{
}
void Agent::Initialize ()
{
}
Action Agent::Process (Percept& percept)
{
char c;
Action action;
bool validAction = false;
while (! validAction)
{
validAction = true;
cout << "Action? ";
cin >> c;
if (c == 'f') {
action = GOFORWARD;
} else if (c == 'l') {
action = TURNLEFT;
} else if (c == 'r') {
action = TURNRIGHT;
} else if (c == 'g') {
action = GRAB;
} else if (c == 's') {
action = SHOOT;
} else if (c == 'c') {
action = CLIMB;
} else {
cout << "Huh?" << endl;
validAction = false;
}
}
return action;
}
void Agent::GameOver (int score)
{
}