Commit 74c61f55 authored by Matthew Hausknecht's avatar Matthew Hausknecht

Merge branch 'master' of github.com:larg/HFO

parents ea53640b 6b328eff
...@@ -7,7 +7,6 @@ RoboCup 2D Half Field Offense ...@@ -7,7 +7,6 @@ RoboCup 2D Half Field Offense
## Dependencies ## Dependencies
- Boost-system, filesystem - Boost-system, filesystem
- Flex
- Qt4 [Required for SoccerWindow2 visualizer]: To not build the visualizer, add cmake flag `-DBUILD_SOCCERWINDOW=False` - Qt4 [Required for SoccerWindow2 visualizer]: To not build the visualizer, add cmake flag `-DBUILD_SOCCERWINDOW=False`
## Install ## Install
...@@ -21,6 +20,11 @@ make install ...@@ -21,6 +20,11 @@ make install
From the main HFO directory: `pip install [--user] .` From the main HFO directory: `pip install [--user] .`
## Demos ## Demos
From the main HFO directory:
```
./example/passing_agents.sh
```
Start a 1v1 game played by Agent2D: Start a 1v1 game played by Agent2D:
``` ```
./bin/HFO --offense-npcs=1 --defense-npcs=1 --no-sync ./bin/HFO --offense-npcs=1 --defense-npcs=1 --no-sync
...@@ -43,12 +47,13 @@ minimal examples: ...@@ -43,12 +47,13 @@ minimal examples:
#### C++ Agent #### C++ Agent
```c++ ```c++
HFOEnvironment hfo; HFOEnvironment hfo;
hfo.connectToAgentServer(6000, LOW_LEVEL_FEATURE_SET); hfo.connectToServer(...);
for (int episode=0; episode<5; episode++) { for (int episode=0; episode<5; episode++) {
status_t status = IN_GAME; status_t status = IN_GAME;
while (status == IN_GAME) { while (status == IN_GAME) {
const std::vector<float>& feature_vec = hfo.getState(); const std::vector<float>& feature_vec = hfo.getState();
status = hfo.act(DASH, 20.0, 0.0); hfo.act(DASH, 20.0, 0.0);
status = hfo.step();
} }
cout << "Episode " << episode << " ended"; cout << "Episode " << episode << " ended";
} }
...@@ -57,12 +62,13 @@ for (int episode=0; episode<5; episode++) { ...@@ -57,12 +62,13 @@ for (int episode=0; episode<5; episode++) {
#### Python Agent #### Python Agent
```python ```python
hfo = hfo.HFOEnvironment() hfo = hfo.HFOEnvironment()
hfo.connectToAgentServer(6000, HFO_Features.LOW_LEVEL_FEATURE_SET) hfo.connectServer(...)
for episode in xrange(5): for episode in xrange(5):
status = HFO_Status.IN_GAME status = IN_GAME
while status == HFO_Status.IN_GAME: while status == IN_GAME:
features = hfo.getState() features = hfo.getState()
status = hfo.act(HFO_Actions.DASH, 20.0, 0.0) hfo.act(DASH, 20.0, 0.0)
status = hfo.step()
print 'Episode', episode, 'ended' print 'Episode', episode, 'ended'
``` ```
......
...@@ -24,7 +24,7 @@ int main() { ...@@ -24,7 +24,7 @@ int main() {
// Connect to the server and request low-level feature set. See // Connect to the server and request low-level feature set. See
// manual for more information on feature sets. // manual for more information on feature sets.
hfo.connectToServer(features, config_dir, unum, port, server_addr, hfo.connectToServer(features, config_dir, unum, port, server_addr,
team_name, goalie); team_name, goalie);
// Play 5 episodes // Play 5 episodes
for (int episode=0; episode<5; episode++) { for (int episode=0; episode<5; episode++) {
status_t status = IN_GAME; status_t status = IN_GAME;
......
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