Commit b00c5c18 authored by Matthew Hausknecht's avatar Matthew Hausknecht

Updated Readme.

parent 20a4d7ef
...@@ -38,5 +38,26 @@ Or do both in a single command: ...@@ -38,5 +38,26 @@ Or do both in a single command:
## Example Agents ## Example Agents
Example C++ and Python agents are provided in the `example` directory. Example C++ and Python agents are provided in the `example` directory.
#### Example C++ Agent
```c++
HFOEnvironment hfo;
// Connect to the agent's server on port 6000 and request low-level
// feature set. See manual for more information on feature sets.
hfo.connectToAgentServer(6000, LOW_LEVEL_FEATURE_SET);
// Play 5 episodes
for (int episode=0; episode<5; episode++) {
status_t status = IN_GAME;
while (status == IN_GAME) {
// Get the vector of state features for the current state
const std::vector<float>& feature_vec = hfo.getState();
// Create a dash action
Action a = {DASH, 20.0, 0.0};
// Perform the dash and recieve the current game status
status = hfo.act(a);
}
// Check what the outcome of the episode was
cout << "Episode " << episode << " ended with status: ";
```
## Documentation ## Documentation
The state and action spaces provided by the HFO domain are documented in the [manual](doc/manual.pdf). The state and action spaces provided by the HFO domain are documented in the [manual](doc/manual.pdf).
\ No newline at end of file
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