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
875bde45
Commit
875bde45
authored
Feb 23, 2016
by
Matthew Hausknecht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated with extra sleeps
parent
b336a23f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
bin/Trainer.py
bin/Trainer.py
+16
-10
src/common.hpp
src/common.hpp
+0
-1
No files found.
bin/Trainer.py
View file @
875bde45
...
@@ -337,6 +337,18 @@ class Trainer(object):
...
@@ -337,6 +337,18 @@ class Trainer(object):
""" Returns true all players are connected. """
""" Returns true all players are connected. """
return
len
(
self
.
_connectedPlayers
)
==
self
.
_numOffense
+
self
.
_numDefense
return
len
(
self
.
_connectedPlayers
)
==
self
.
_numOffense
+
self
.
_numDefense
def
sendHFOConfig
(
self
):
""" Broadcast the HFO configuration """
offense_nums
=
' '
.
join
([
str
(
self
.
convertToExtPlayer
(
self
.
_offenseTeamName
,
i
))
for
i
in
xrange
(
1
,
self
.
_numOffense
+
1
)])
defense_nums
=
' '
.
join
([
str
(
self
.
convertToExtPlayer
(
self
.
_defenseTeamName
,
i
))
for
i
in
xrange
(
self
.
_numDefense
)])
self
.
send
(
'(say HFO_SETUP offense_name
%
s defense_name
%
s num_offense
%
d'
\
' num_defense
%
d offense_nums
%
s defense_nums
%
s)'
%
(
self
.
_offenseTeamName
,
self
.
_defenseTeamName
,
self
.
_numOffense
,
self
.
_numDefense
,
offense_nums
,
defense_nums
))
def
startGame
(
self
):
def
startGame
(
self
):
""" Starts a game of HFO. """
""" Starts a game of HFO. """
self
.
send
(
'(change_mode play_on)'
)
self
.
send
(
'(change_mode play_on)'
)
...
@@ -415,17 +427,11 @@ class Trainer(object):
...
@@ -415,17 +427,11 @@ class Trainer(object):
while
not
self
.
allPlayersConnected
():
while
not
self
.
allPlayersConnected
():
self
.
getConnectedPlayers
()
self
.
getConnectedPlayers
()
# Broadcast the HFO configuration
time
.
sleep
(
0.1
)
offense_nums
=
' '
.
join
([
str
(
self
.
convertToExtPlayer
(
self
.
_offenseTeamName
,
i
))
self
.
sendHFOConfig
()
for
i
in
xrange
(
1
,
self
.
_numOffense
+
1
)])
defense_nums
=
' '
.
join
([
str
(
self
.
convertToExtPlayer
(
self
.
_defenseTeamName
,
i
))
for
i
in
xrange
(
self
.
_numDefense
)])
self
.
send
(
'(say HFO_SETUP offense_name
%
s defense_name
%
s num_offense
%
d'
\
' num_defense
%
d offense_nums
%
s defense_nums
%
s)'
%
(
self
.
_offenseTeamName
,
self
.
_defenseTeamName
,
self
.
_numOffense
,
self
.
_numDefense
,
offense_nums
,
defense_nums
))
print
'Starting game'
print
'Starting game'
time
.
sleep
(
0.1
)
self
.
startGame
()
self
.
startGame
()
while
self
.
allPlayersConnected
()
and
self
.
checkLive
(
necProcesses
)
and
not
self
.
_done
:
while
self
.
allPlayersConnected
()
and
self
.
checkLive
(
necProcesses
)
and
not
self
.
_done
:
prevFrame
=
self
.
_frame
prevFrame
=
self
.
_frame
...
...
src/common.hpp
View file @
875bde45
...
@@ -181,7 +181,6 @@ inline bool ParseConfig(const std::string& message, Config& config) {
...
@@ -181,7 +181,6 @@ inline bool ParseConfig(const std::string& message, Config& config) {
std
::
string
key
,
val
;
std
::
string
key
,
val
;
iss
>>
key
;
iss
>>
key
;
if
(
header
.
compare
(
key
)
!=
0
)
{
if
(
header
.
compare
(
key
)
!=
0
)
{
std
::
cerr
<<
"Got unexpected message header: "
<<
header
;
return
false
;
return
false
;
}
}
while
(
iss
>>
key
)
{
while
(
iss
>>
key
)
{
...
...
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