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
34a71542
Commit
34a71542
authored
Jul 16, 2017
by
drallensmith
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'randomization' into add_preprocess_action - bring in updates/fixes, avoid rebase
parents
260c2416
1c57d3f1
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
310 additions
and
11 deletions
+310
-11
.gitignore
.gitignore
+1
-0
example/defense_2v2.sh
example/defense_2v2.sh
+14
-0
example/defense_python_2v2.sh
example/defense_python_2v2.sh
+12
-0
example/defense_python_3v3.sh
example/defense_python_3v3.sh
+12
-0
example/hand_coded_defense_agent
example/hand_coded_defense_agent
+0
-0
example/hand_coded_defense_agent.cpp
example/hand_coded_defense_agent.cpp
+18
-11
example/hand_coded_defense_agent.py
example/hand_coded_defense_agent.py
+251
-0
src/agent.cpp
src/agent.cpp
+2
-0
No files found.
.gitignore
View file @
34a71542
...
@@ -73,6 +73,7 @@ example/mid_level_move_agent
...
@@ -73,6 +73,7 @@ example/mid_level_move_agent
example/mid_level_kick_agent
example/mid_level_kick_agent
example/mid_level_dribble_agent
example/mid_level_dribble_agent
example/communication_agent
example/communication_agent
example/hand_coded_defense_agent
# Dependency directories
# Dependency directories
librcsc-prefix/
librcsc-prefix/
...
...
example/defense_2v2.sh
0 → 100755
View file @
34a71542
#!/bin/bash
# HAS TO BE RUN FROM EXAMPLE DIR DUE TO hand_coded_defense_agent CONFIG!
../bin/HFO
--offense-npcs
=
2
--defense-agents
=
1
--defense-npcs
=
1
--trials
20
--headless
--port
=
7000 &
sleep
5
./hand_coded_defense_agent &> 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/defense_python_2v2.sh
0 → 100755
View file @
34a71542
#!/bin/bash
./bin/HFO
--offense-npcs
=
2
--defense-agents
=
1
--defense-npcs
=
1
--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/defense_python_3v3.sh
0 → 100755
View file @
34a71542
#!/bin/bash
./bin/HFO
--offense-npcs
=
3
--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
deleted
100755 → 0
View file @
260c2416
File deleted
example/hand_coded_defense_agent.cpp
View file @
34a71542
...
@@ -208,7 +208,8 @@ int main(int argc, char** argv) {
...
@@ -208,7 +208,8 @@ int main(int argc, char** argv) {
HFOEnvironment
hfo
;
HFOEnvironment
hfo
;
int
random
=
0
;
int
random
=
0
;
double
numGoals
=
0
;
double
numGoals
=
0
;
double
numEpisodes
=
5000
;
int
numEpisodes
=
5000
;
double
actualNumEpisodes
=
0
;
// Connect to the server and request high-level feature set. See
// Connect to the server and request high-level feature set. See
// manual for more information on feature sets.
// manual for more information on feature sets.
hfo
.
connectToServer
(
features
,
config_dir
,
port
,
server_addr
,
hfo
.
connectToServer
(
features
,
config_dir
,
port
,
server_addr
,
...
@@ -233,10 +234,10 @@ int main(int argc, char** argv) {
...
@@ -233,10 +234,10 @@ int main(int argc, char** argv) {
string
s
=
hfo
::
ActionToString
(
a
.
action
)
+
" "
+
to_string
(
a
.
param
)
+
"
\n
"
;
string
s
=
hfo
::
ActionToString
(
a
.
action
)
+
" "
+
to_string
(
a
.
param
)
+
"
\n
"
;
// std::cout << s;
// std::cout << s;
}
else
{
}
else
{
std
::
cout
<<
"Rand
m"
;
std
::
cout
<<
"Rando
m"
;
action_t
a
=
get_random_high_lv_action
();
action_t
a
=
get_random_high_lv_action
();
if
(
a
==
hfo
::
MARK_PLAYER
)
{
if
(
a
==
hfo
::
MARK_PLAYER
)
{
hfo
.
act
(
NOOP
);
hfo
.
act
(
NOOP
);
// why not MOVE?
}
else
{
}
else
{
hfo
.
act
(
a
);
hfo
.
act
(
a
);
}
}
...
@@ -249,8 +250,14 @@ int main(int argc, char** argv) {
...
@@ -249,8 +250,14 @@ int main(int argc, char** argv) {
// Check what the outcome of the episode was
// Check what the outcome of the episode was
cout
<<
"Episode "
<<
episode
<<
" ended with status: "
cout
<<
"Episode "
<<
episode
<<
" ended with status: "
<<
StatusToString
(
status
)
<<
std
::
endl
;
<<
StatusToString
(
status
)
<<
std
::
endl
;
if
(
status
==
SERVER_DOWN
)
{
break
;
}
else
{
actualNumEpisodes
++
;
}
}
}
double
cost
=
numGoals
/
n
umEpisodes
;
double
cost
=
numGoals
/
actualN
umEpisodes
;
hfo
.
act
(
QUIT
);
hfo
.
act
(
QUIT
);
//write_cost(cost);
//write_cost(cost);
};
};
...
...
example/hand_coded_defense_agent.py
0 → 100755
View file @
34a71542
This diff is collapsed.
Click to expand it.
src/agent.cpp
View file @
34a71542
...
@@ -923,10 +923,12 @@ bool Agent::doMarkPlayer(int unum) {
...
@@ -923,10 +923,12 @@ bool Agent::doMarkPlayer(int unum) {
int
count
=
0
;
int
count
=
0
;
for
(
PlayerPtrCont
::
const_iterator
it
=
wm
.
opponentsFromSelf
().
begin
();
it
!=
o_end
;
++
it
)
{
for
(
PlayerPtrCont
::
const_iterator
it
=
wm
.
opponentsFromSelf
().
begin
();
it
!=
o_end
;
++
it
)
{
if
(
(
*
it
)
->
distFromBall
()
<
5
)
{
if
(
(
*
it
)
->
distFromBall
()
<
5
)
{
if
((
kicker_unum
==
-
1
)
||
(
kicker_unum
!=
unum
))
{
// try to obey action instruction
kicker_pos
=
(
*
it
)
->
pos
();
kicker_pos
=
(
*
it
)
->
pos
();
kicker_unum
=
(
*
it
)
->
unum
();
kicker_unum
=
(
*
it
)
->
unum
();
}
}
}
}
}
for
(
PlayerPtrCont
::
const_iterator
it
=
wm
.
opponentsFromSelf
().
begin
();
it
!=
o_end
;
++
it
)
{
for
(
PlayerPtrCont
::
const_iterator
it
=
wm
.
opponentsFromSelf
().
begin
();
it
!=
o_end
;
++
it
)
{
if
(
(
*
it
)
->
unum
()
==
unum
)
{
if
(
(
*
it
)
->
unum
()
==
unum
)
{
...
...
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