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
7435a741
Commit
7435a741
authored
Jul 16, 2017
by
drallensmith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trying to figure out agent-as-goalie problem
parent
1c57d3f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
example/defense_python_2v3.sh
example/defense_python_2v3.sh
+12
-0
example/hand_coded_defense_agent.py
example/hand_coded_defense_agent.py
+11
-1
No files found.
example/defense_python_2v3.sh
0 → 100755
View file @
7435a741
#!/bin/bash
./bin/HFO
--offense-npcs
=
2
--defense-agents
=
1
--defense-npcs
=
2
--trials
20
--headless
&
sleep
5
./example/hand_coded_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/hand_coded_defense_agent.py
View file @
7435a741
...
@@ -221,12 +221,22 @@ def main():
...
@@ -221,12 +221,22 @@ def main():
print
(
"Python randomization seed useless without --epsilon >0"
)
print
(
"Python randomization seed useless without --epsilon >0"
)
if
args
.
epsilon
>
0
:
if
args
.
epsilon
>
0
:
print
(
"Using epsilon {0:n}"
.
format
(
args
.
epsilon
))
print
(
"Using epsilon {0:n}"
.
format
(
args
.
epsilon
))
my_unum
=
hfo_env
.
getUnum
()
assert
((
my_unum
>
1
)
and
(
my_unum
<=
11
)),
"Bad unum {!r}"
.
format
(
my_unum
)
print
(
"My unum is {0:d}"
.
format
(
my_unum
))
for
episode
in
itertools
.
count
():
for
episode
in
itertools
.
count
():
old_ball_pos_x
=
0
old_ball_pos_x
=
-
1
old_ball_pos_y
=
0
old_ball_pos_y
=
0
episode_start
=
True
status
=
hfo
.
IN_GAME
status
=
hfo
.
IN_GAME
while
status
==
hfo
.
IN_GAME
:
while
status
==
hfo
.
IN_GAME
:
state
=
hfo_env
.
getState
()
state
=
hfo_env
.
getState
()
if
episode_start
:
if
(
state
[
3
]
>=
-
1
)
and
(
state
[
3
]
<=
1
):
old_ball_pos_x
=
state
[
3
]
if
(
state
[
4
]
>=
-
1
)
and
(
state
[
4
]
<=
1
):
old_ball_pos_y
=
state
[
4
]
episode_start
=
False
if
(
args
.
epsilon
>
0
)
and
(
random
.
random
()
<
args
.
epsilon
):
if
(
args
.
epsilon
>
0
)
and
(
random
.
random
()
<
args
.
epsilon
):
do_random_defense_action
(
state
,
hfo_env
)
do_random_defense_action
(
state
,
hfo_env
)
else
:
else
:
...
...
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