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
3d5dbf1f
Commit
3d5dbf1f
authored
Jul 16, 2017
by
drallensmith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
One last try before really rethinking
parent
475ccb90
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
example/hand_coded_defense_agent.py
example/hand_coded_defense_agent.py
+10
-6
No files found.
example/hand_coded_defense_agent.py
View file @
3d5dbf1f
...
@@ -111,7 +111,14 @@ def do_defense_action(state_vec, hfo_env, episode,
...
@@ -111,7 +111,14 @@ def do_defense_action(state_vec, hfo_env, episode,
hfo_env
.
act
(
hfo
.
MOVE
)
hfo_env
.
act
(
hfo
.
MOVE
)
return
return
if
ball_toward_goal
and
(
ball_sorted_list
[
0
][
1
]
<
params
[
'LOW_KICK_DIST'
]):
goal_sorted_list
=
get_sorted_opponents
(
state_vec
,
num_opponents
,
num_teammates
,
pos_x
=
GOAL_POS_X
,
pos_y
=
GOAL_POS_Y
)
if
ball_toward_goal
:
if
ball_sorted_list
[
0
][
1
]
<
params
[
'LOW_KICK_DIST'
]:
ball_toward_goal
=
False
elif
goal_sorted_list
[
0
][
1
]
<
get_dist_normalized
(
ball_pos_x
,
ball_pos_y
,
GOAL_POS_X
,
GOAL_POS_Y
):
ball_toward_goal
=
False
ball_toward_goal
=
False
is_tackleable_opp
=
is_tackleable
(
agent_pos_x
,
agent_pos_y
,
is_tackleable_opp
=
is_tackleable
(
agent_pos_x
,
agent_pos_y
,
...
@@ -156,8 +163,6 @@ def do_defense_action(state_vec, hfo_env, episode,
...
@@ -156,8 +163,6 @@ def do_defense_action(state_vec, hfo_env, episode,
return
return
if
ball_sorted_list
[
0
][
1
]
<
params
[
'KICK_DIST'
]:
if
ball_sorted_list
[
0
][
1
]
<
params
[
'KICK_DIST'
]:
goal_sorted_list
=
get_sorted_opponents
(
state_vec
,
num_opponents
,
num_teammates
,
pos_x
=
GOAL_POS_X
,
pos_y
=
GOAL_POS_Y
)
if
goal_sorted_list
[
0
][
0
]
!=
ball_sorted_list
[
0
][
0
]:
# top in each are opponents to worry about
if
goal_sorted_list
[
0
][
0
]
!=
ball_sorted_list
[
0
][
0
]:
# top in each are opponents to worry about
if
is_in_open_area
(
ball_sorted_list
[
0
][
2
],
ball_sorted_list
[
0
][
3
])
and
(
goal_sorted_list
[
0
][
1
]
if
is_in_open_area
(
ball_sorted_list
[
0
][
2
],
ball_sorted_list
[
0
][
3
])
and
(
goal_sorted_list
[
0
][
1
]
<
params
[
'KICK_DIST'
]):
<
params
[
'KICK_DIST'
]):
...
@@ -195,8 +200,7 @@ def do_defense_action(state_vec, hfo_env, episode,
...
@@ -195,8 +200,7 @@ def do_defense_action(state_vec, hfo_env, episode,
hfo_env
.
act
(
hfo
.
GO_TO_BALL
)
hfo_env
.
act
(
hfo
.
GO_TO_BALL
)
return
return
goal_sorted_list
=
get_sorted_opponents
(
state_vec
,
num_opponents
,
num_teammates
,
pos_x
=
GOAL_POS_X
,
pos_y
=
GOAL_POS_Y
)
if
is_in_open_area
(
goal_sorted_list
[
0
][
2
],
goal_sorted_list
[
0
][
3
]):
if
is_in_open_area
(
goal_sorted_list
[
0
][
2
],
goal_sorted_list
[
0
][
3
]):
hfo_env
.
act
(
hfo
.
MOVE
)
hfo_env
.
act
(
hfo
.
MOVE
)
elif
goal_sorted_list
[
0
][
1
]
<
min
(
params
[
'KICK_DIST'
],
elif
goal_sorted_list
[
0
][
1
]
<
min
(
params
[
'KICK_DIST'
],
...
...
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