Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Seminar-HFO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
Seminar-HFO
Commits
d56ba025
You need to sign in or sign up before continuing.
Commit
d56ba025
authored
Jun 25, 2017
by
Matthew Hausknecht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added defense agent example.
parent
09fe6e7e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
example/defense_1v1.sh
example/defense_1v1.sh
+12
-0
example/example_defense_agent.py
example/example_defense_agent.py
+35
-0
No files found.
example/defense_1v1.sh
0 → 100755
View file @
d56ba025
#!/bin/bash
./bin/HFO
--offense-npcs
=
1
--defense-agents
=
1
--trials
20
--agent-play-goalie
--headless
&
sleep
5
./example/example_defense_agent.py &> agent1.txt &
sleep
5
# The magic line
# $$ holds the PID for this script
# Negation means kill by process group id instead of PID
trap
"kill -TERM -
$$
"
SIGINT
wait
\ No newline at end of file
example/example_defense_agent.py
0 → 100755
View file @
d56ba025
#!/usr/bin/env python
# encoding: utf-8
# Before running this program, first Start HFO server:
# $> ./bin/HFO --offense-agents 1
import
itertools
from
hfo
import
*
def
main
():
# Create the HFO Environment
hfo
=
HFOEnvironment
()
# Connect to the server with the specified
# feature set. See feature sets in hfo.py/hfo.hpp.
hfo
.
connectToServer
(
LOW_LEVEL_FEATURE_SET
,
'bin/teams/base/config/formations-dt'
,
6000
,
'localhost'
,
'base_right'
,
True
)
for
episode
in
itertools
.
count
():
status
=
IN_GAME
while
status
==
IN_GAME
:
# Grab the state features from the environment
features
=
hfo
.
getState
()
# Take an action and get the current game status
hfo
.
act
(
DASH
,
20.0
,
0.
)
# Advance the environment and get the game status
status
=
hfo
.
step
()
# Check the outcome of the episode
print
((
'Episode
%
d ended with
%
s'
%
(
episode
,
hfo
.
statusToString
(
status
))))
# Quit if the server goes down
if
status
==
SERVER_DOWN
:
hfo
.
act
(
QUIT
)
break
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment