Commit 63c3fb68 authored by sanmit's avatar sanmit

More minor edits

parent 424e5005
...@@ -19,7 +19,7 @@ if __name__ == '__main__': ...@@ -19,7 +19,7 @@ if __name__ == '__main__':
# Connect to the agent server on port 6000 with the specified # Connect to the agent server on port 6000 with the specified
# feature set. See feature sets in hfo.py/hfo.hpp. # feature set. See feature sets in hfo.py/hfo.hpp.
hfo.connectToAgentServer(port, HFO_Features.HIGH_LEVEL_FEATURE_SET) hfo.connectToAgentServer(port, HFO_Features.HIGH_LEVEL_FEATURE_SET)
# Play 5 episodes # Play 100 episodes
for episode in xrange(100): for episode in xrange(100):
status = HFO_Status.IN_GAME status = HFO_Status.IN_GAME
while status == HFO_Status.IN_GAME: while status == HFO_Status.IN_GAME:
......
...@@ -369,17 +369,17 @@ std::vector<int> Agent::getGameStatus(const rcsc::AudioSensor& audio_sensor, ...@@ -369,17 +369,17 @@ std::vector<int> Agent::getGameStatus(const rcsc::AudioSensor& audio_sensor,
std::vector<int> status; std::vector<int> status;
status_t game_status = IN_GAME; status_t game_status = IN_GAME;
int playerIndex = -1; // Keeps track of which defender stopped the shot int playerIndex = -1; // Keeps track of which defender stopped the shot
int playerTeam = 1; // 1 = offense, -1 = defense, 0 = no possession int playerTeam = hfo::LEFT;
if (audio_sensor.trainerMessageTime().cycle() > lastTrainerMessageTime) { if (audio_sensor.trainerMessageTime().cycle() > lastTrainerMessageTime) {
const std::string& message = audio_sensor.trainerMessage(); const std::string& message = audio_sensor.trainerMessage();
bool recognized_message = true; bool recognized_message = true;
if (message.find("GOAL") != std::string::npos){ if (message.find("GOAL") != std::string::npos){
playerIndex = atoi((message.substr(message.find("-")+1)).c_str()); playerIndex = atoi((message.substr(message.find("-")+1)).c_str());
playerTeam = 1; playerTeam = hfo::LEFT;
game_status = GOAL; game_status = GOAL;
} else if (message.find("CAPTURED_BY_DEFENSE") != std::string::npos) { } else if (message.find("CAPTURED_BY_DEFENSE") != std::string::npos) {
playerIndex = atoi((message.substr(message.find("-")+1)).c_str()); playerIndex = atoi((message.substr(message.find("-")+1)).c_str());
playerTeam = -1; playerTeam = hfo::RIGHT;
game_status = CAPTURED_BY_DEFENSE; game_status = CAPTURED_BY_DEFENSE;
} else if (message.compare("OUT_OF_BOUNDS") == 0) { } else if (message.compare("OUT_OF_BOUNDS") == 0) {
game_status = OUT_OF_BOUNDS; game_status = OUT_OF_BOUNDS;
...@@ -388,13 +388,13 @@ std::vector<int> Agent::getGameStatus(const rcsc::AudioSensor& audio_sensor, ...@@ -388,13 +388,13 @@ std::vector<int> Agent::getGameStatus(const rcsc::AudioSensor& audio_sensor,
} else if (message.find("IN_GAME") != std::string::npos){ } else if (message.find("IN_GAME") != std::string::npos){
switch (message.at(message.find("-")+1)){ switch (message.at(message.find("-")+1)){
case 'L': case 'L':
playerTeam = 1; playerTeam = hfo::LEFT;
break; break;
case 'R': case 'R':
playerTeam = -1; playerTeam = hfo::RIGHT;
break; break;
case 'U': case 'U':
playerTeam = 0; playerTeam = hfo::NEUTRAL;
break; break;
} }
playerIndex = atoi((message.substr(message.find("-")+2)).c_str()); playerIndex = atoi((message.substr(message.find("-")+2)).c_str());
......
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