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
52b11c2c
Commit
52b11c2c
authored
Jul 15, 2017
by
drallensmith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved calling of Reorient in high_action_random_agent.py
parent
bdeb5ecc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
example/high_action_random_agent.py
example/high_action_random_agent.py
+7
-4
No files found.
example/high_action_random_agent.py
View file @
52b11c2c
...
@@ -47,15 +47,18 @@ def main():
...
@@ -47,15 +47,18 @@ def main():
# Get the vector of state features for the current state
# Get the vector of state features for the current state
state
=
hfo_env
.
getState
()
state
=
hfo_env
.
getState
()
# Perform the action
# Perform the action
if
state
[
12
]
>
0
:
# State[12] is 1 when the player can kick the ball
# 8 is frozen; 0 is self position valid, 1 is self velocity valid, 54 is ball velocity valid
if
(((
state
[
8
]
>
0
)
or
(
min
(
state
[
0
],
state
[
1
],
state
[
54
])
<
0
))
and
not
args
.
no_reorient
):
hfo_env
.
act
(
hfo
.
REORIENT
)
num_reorient
+=
1
elif
state
[
12
]
>
0
:
# State[12] is 1 when the player can kick the ball
if
random
.
random
()
<
0.5
:
# more efficient than random.choice for 2
if
random
.
random
()
<
0.5
:
# more efficient than random.choice for 2
hfo_env
.
act
(
hfo
.
SHOOT
)
hfo_env
.
act
(
hfo
.
SHOOT
)
else
:
else
:
hfo_env
.
act
(
hfo
.
DRIBBLE
)
hfo_env
.
act
(
hfo
.
DRIBBLE
)
num_had_ball
+=
1
num_had_ball
+=
1
# 8 is frozen; rest are self or ball position/velocity valid
# 50 is ball position valild
elif
(((
state
[
8
]
>
0
)
or
(
min
(
state
[
0
],
state
[
1
],
state
[
50
],
state
[
54
])
<
0
))
and
elif
(
state
[
50
]
<
0
)
and
not
args
.
no_reorient
:
not
args
.
no_reorient
):
hfo_env
.
act
(
hfo
.
REORIENT
)
hfo_env
.
act
(
hfo
.
REORIENT
)
num_reorient
+=
1
num_reorient
+=
1
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