Commit d0ae33f4 authored by drallensmith's avatar drallensmith

Merge branch 'master' into mark_player_better - bring in updates, avoid rebase

parents 944de933 8426776e
...@@ -73,6 +73,7 @@ example/mid_level_move_agent ...@@ -73,6 +73,7 @@ example/mid_level_move_agent
example/mid_level_kick_agent example/mid_level_kick_agent
example/mid_level_dribble_agent example/mid_level_dribble_agent
example/communication_agent example/communication_agent
example/hand_coded_defense_agent
# Dependency directories # Dependency directories
librcsc-prefix/ librcsc-prefix/
......
...@@ -208,7 +208,8 @@ int main(int argc, char** argv) { ...@@ -208,7 +208,8 @@ int main(int argc, char** argv) {
HFOEnvironment hfo; HFOEnvironment hfo;
int random = 0; int random = 0;
double numGoals = 0; double numGoals = 0;
double numEpisodes = 5000; int numEpisodes = 5000;
double actualNumEpisodes = 0;
// Connect to the server and request high-level feature set. See // Connect to the server and request high-level feature set. See
// manual for more information on feature sets. // manual for more information on feature sets.
hfo.connectToServer(features, config_dir, port, server_addr, hfo.connectToServer(features, config_dir, port, server_addr,
...@@ -233,15 +234,15 @@ int main(int argc, char** argv) { ...@@ -233,15 +234,15 @@ int main(int argc, char** argv) {
string s = hfo::ActionToString(a.action) + " " +to_string(a.param) + "\n"; string s = hfo::ActionToString(a.action) + " " +to_string(a.param) + "\n";
// std::cout << s; // std::cout << s;
} else { } else {
std::cout <<"Randm"; std::cout <<"Random";
action_t a = get_random_high_lv_action(); action_t a = get_random_high_lv_action();
if (a == hfo :: MARK_PLAYER) { if (a == hfo :: MARK_PLAYER) {
hfo.act(NOOP); hfo.act(NOOP); // why not MOVE?
} else { } else {
hfo.act(a); hfo.act(a);
} }
} }
//hfo.act(hfo::INTERCEPT); //hfo.act(hfo::INTERCEPT);
status = hfo.step(); status = hfo.step();
} }
if (status==GOAL) if (status==GOAL)
...@@ -249,8 +250,14 @@ int main(int argc, char** argv) { ...@@ -249,8 +250,14 @@ int main(int argc, char** argv) {
// Check what the outcome of the episode was // Check what the outcome of the episode was
cout << "Episode " << episode << " ended with status: " cout << "Episode " << episode << " ended with status: "
<< StatusToString(status) << std::endl; << StatusToString(status) << std::endl;
if (status==SERVER_DOWN) {
break;
} else {
actualNumEpisodes++;
}
} }
double cost = numGoals/numEpisodes; double cost = numGoals/actualNumEpisodes;
hfo.act(QUIT); hfo.act(QUIT);
//write_cost(cost); //write_cost(cost);
}; };
......
# Run this file to create an executable of hand_coded_defense_agent.cpp
g++ -c hand_coded_defense_agent.cpp -I ../src/ -std=c++0x -pthread
g++ -L ../lib/ hand_coded_defense_agent.o -lhfo -pthread -o hand_coded_defense_agent -Wl,-rpath,../lib
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment