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
e74344b7
Commit
e74344b7
authored
Jul 18, 2017
by
drallensmith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated hand*py with further on REORIENT
parent
3191ab74
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
example/hand_coded_defense_agent.py
example/hand_coded_defense_agent.py
+11
-6
No files found.
example/hand_coded_defense_agent.py
View file @
e74344b7
...
@@ -104,7 +104,7 @@ def do_defense_action(state_vec, hfo_env,
...
@@ -104,7 +104,7 @@ def do_defense_action(state_vec, hfo_env,
# if get high_level working for invalid
# if get high_level working for invalid
if
(
min
(
agent_pos_x
,
agent_pos_y
,
ball_pos_x
,
ball_pos_y
)
<
-
1
):
if
(
min
(
agent_pos_x
,
agent_pos_y
,
ball_pos_x
,
ball_pos_y
)
<
-
1
):
hfo_env
.
act
(
hfo
.
REORIENT
)
hfo_env
.
act
(
add_num_times
(
hfo
.
REORIENT
,
num_times_overall
)
)
return
return
ball_toward_goal
=
ball_moving_toward_goal
(
ball_pos_x
,
ball_pos_y
,
ball_toward_goal
=
ball_moving_toward_goal
(
ball_pos_x
,
ball_pos_y
,
...
@@ -118,11 +118,16 @@ def do_defense_action(state_vec, hfo_env,
...
@@ -118,11 +118,16 @@ def do_defense_action(state_vec, hfo_env,
if
not
ball_sorted_list
:
# unknown opponent positions/unums
if
not
ball_sorted_list
:
# unknown opponent positions/unums
print
(
"No known opponent locations (btg {0!r}; bng {1!r}; "
.
format
(
ball_toward_goal
,
print
(
"No known opponent locations (btg {0!r}; bng {1!r}; "
.
format
(
ball_toward_goal
,
ball_nearer_goal
)
+
ball_nearer_goal
)
+
"ball xy {0:n}, {1:n}; ball old xy {2:n}, {3:n})"
.
format
(
ball_pos_x
,
"ball xy {0:n}, {1:n}; ball old xy {2:n}, {3:n}
; kickable {4:n}
)"
.
format
(
ball_pos_x
,
ball_pos_y
,
ball_pos_y
,
old_ball_pos_x
,
old_ball_pos_x
,
old_ball_pos_y
))
old_ball_pos_y
,
if
ball_toward_goal
:
state_vec
[
5
]))
if
((
min
(
agent_pos_x
,
agent_pos_y
,
ball_pos_x
,
ball_pos_y
)
<=
-
1
)
or
(
max
(
agent_pos_x
,
agent_pos_y
,
ball_pos_x
,
ball_pos_y
)
>=
1
)):
# remove if get high-level working for invalid
hfo_env
.
act
(
add_num_times
(
hfo
.
REORIENT
,
num_times_overall
))
elif
ball_toward_goal
:
if
ball_nearer_goal
:
if
ball_nearer_goal
:
hfo_env
.
act
(
add_num_times
(
hfo
.
REDUCE_ANGLE_TO_GOAL
,
num_times_overall
))
hfo_env
.
act
(
add_num_times
(
hfo
.
REDUCE_ANGLE_TO_GOAL
,
num_times_overall
))
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