Commit 77bcc245 authored by Matthew Hausknecht's avatar Matthew Hausknecht

Moved action enums into hfo.hpp and put hfo head in src directory.

parent 6afa2197
...@@ -9,7 +9,6 @@ set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) ...@@ -9,7 +9,6 @@ set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
${SOURCE_DIR} ${SOURCE_DIR}
${SOURCE_DIR}/chain_action ${SOURCE_DIR}/chain_action
${LIBRCSC_INCLUDE} ${LIBRCSC_INCLUDE}
...@@ -37,7 +36,7 @@ add_executable(sample_coach ${SOURCE_DIR}/main_coach.cpp ${SOURCE_DIR}/sample_co ...@@ -37,7 +36,7 @@ add_executable(sample_coach ${SOURCE_DIR}/main_coach.cpp ${SOURCE_DIR}/sample_co
add_executable(sample_player ${SOURCE_DIR}/main_player.cpp ${SOURCE_DIR}/sample_player.cpp ${SOURCES}) add_executable(sample_player ${SOURCE_DIR}/main_player.cpp ${SOURCE_DIR}/sample_player.cpp ${SOURCES})
add_executable(sample_trainer ${SOURCE_DIR}/main_trainer.cpp ${SOURCE_DIR}/sample_trainer.cpp ${SOURCES}) add_executable(sample_trainer ${SOURCE_DIR}/main_trainer.cpp ${SOURCE_DIR}/sample_trainer.cpp ${SOURCES})
add_executable(agent ${SOURCE_DIR}/main_agent.cpp ${SOURCE_DIR}/agent.cpp ${SOURCES}) add_executable(agent ${SOURCE_DIR}/main_agent.cpp ${SOURCE_DIR}/agent.cpp ${SOURCES})
add_library(hfo-lib SHARED ${CMAKE_CURRENT_SOURCE_DIR}/include/HFO.hpp ${SOURCE_DIR}/HFO.cpp) add_library(hfo-lib SHARED ${SOURCE_DIR}/HFO.hpp ${SOURCE_DIR}/HFO.cpp)
set_target_properties(hfo-lib PROPERTIES OUTPUT_NAME hfo) set_target_properties(hfo-lib PROPERTIES OUTPUT_NAME hfo)
set_target_properties(hfo-lib PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib) set_target_properties(hfo-lib PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
......
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <HFO.hpp> #include <HFO.hpp>
#include <cstdlib>
using namespace std; using namespace std;
......
...@@ -2,7 +2,32 @@ ...@@ -2,7 +2,32 @@
#define __HFO_HPP__ #define __HFO_HPP__
#include <vector> #include <vector>
#include "agent.h"
// The actions available to the agent
enum action_t
{
DASH, // Dash(power, relative_direction)
TURN, // Turn(direction)
TACKLE, // Tackle(direction)
KICK, // Kick(power, direction)
QUIT // Special action to quit the game
};
// The current status of the HFO game
enum hfo_status_t
{
IN_GAME,
GOAL,
CAPTURED_BY_DEFENSE,
OUT_OF_BOUNDS,
OUT_OF_TIME
};
struct Action {
action_t action;
float arg1;
float arg2;
};
class HFOEnvironment { class HFOEnvironment {
public: public:
...@@ -15,14 +40,6 @@ class HFOEnvironment { ...@@ -15,14 +40,6 @@ class HFOEnvironment {
// Get the current state of the domain. Returns a reference to feature_vec. // Get the current state of the domain. Returns a reference to feature_vec.
const std::vector<float>& getState(); const std::vector<float>& getState();
// The actions available to the agent
// enum action_t
// {
// DASH, // Dash(power, relative_direction)
// TURN, // Turn(direction)
// TACKLE, // Tackle(direction)
// KICK // Kick(power, direction)
// };
// Take an action and recieve the resulting game status // Take an action and recieve the resulting game status
hfo_status_t act(Action action); hfo_status_t act(Action action);
......
...@@ -30,36 +30,11 @@ ...@@ -30,36 +30,11 @@
#include "action_generator.h" #include "action_generator.h"
#include "field_evaluator.h" #include "field_evaluator.h"
#include "communication.h" #include "communication.h"
#include "HFO.hpp"
#include <rcsc/player/player_agent.h> #include <rcsc/player/player_agent.h>
#include <vector> #include <vector>
// The actions available to the agent
enum action_t
{
DASH, // Dash(power, relative_direction)
TURN, // Turn(direction)
TACKLE, // Tackle(direction)
KICK, // Kick(power, direction)
QUIT // Special action to quit the game
};
// The current status of the HFO game
enum hfo_status_t
{
IN_GAME,
GOAL,
CAPTURED_BY_DEFENSE,
OUT_OF_BOUNDS,
OUT_OF_TIME
};
struct Action {
action_t action;
float arg1;
float arg2;
};
class Agent : public rcsc::PlayerAgent { class Agent : public rcsc::PlayerAgent {
public: public:
Agent(); Agent();
......
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