Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ozan Catal
Animal Ai Env
Commits
f203d1d0
Unverified
Commit
f203d1d0
authored
Jun 16, 2020
by
Benjamin Beyret
Committed by
GitHub
Jun 16, 2020
Browse files
Delete load_tmp.py
parent
7d4a5c63
Changes
1
Hide whitespace changes
Inline
Side-by-side
examples/load_tmp.py
deleted
100644 → 0
View file @
7d4a5c63
import
sys
import
random
import
os
from
typing
import
List
from
animalai.envs.arena_config
import
ArenaConfig
from
animalai.envs.environment
import
AnimalAIEnvironment
"""
"""
def
load_config_and_play
(
configurations
:
List
[
str
])
->
None
:
"""
Loads a configuration file for a single arena and lets you play manually
:param configuration_file: str path to the yaml configuration
:return: None
"""
env_path
=
"env/AnimalAI"
# for configuration in configurations:
port
=
5005
+
random
.
randint
(
0
,
10
)
new_configurations
=
[]
for
conf
in
configurations
:
with
open
(
conf
,
'r'
)
as
f
:
if
'Cardbox'
in
f
.
read
():
new_configurations
.
append
(
conf
)
# for cat in range(10,11):
# for exp in range(18,31):
for
configuration
in
new_configurations
:
try
:
port
+=
random
.
randint
(
0
,
10
)
# use a random port to allow relaunching the script rapidly
# configuration = ArenaConfig(configuration_file)
competition_folder
=
"../competition_configurations/"
# configuration = competition_folder+f'{cat}-{exp}-1.yml'
environment
=
AnimalAIEnvironment
(
file_name
=
env_path
,
base_port
=
port
,
arenas_configurations
=
ArenaConfig
(
configuration
),
play
=
True
,
)
# print(f'{cat}-{exp}-1.yml')
print
(
configuration
)
input
()
environment
.
close
()
except
AttributeError
:
pass
# try:
# print(configuration)
# while environment.proc1:
# pass
# except KeyboardInterrupt:
# environment.close()
if
__name__
==
"__main__"
:
if
len
(
sys
.
argv
)
>
1
:
configuration_file
=
sys
.
argv
[
1
]
else
:
competition_folder
=
"../competition_configurations/"
configuration_files
=
os
.
listdir
(
competition_folder
)
full_confs
=
[
competition_folder
+
conf
for
conf
in
configuration_files
if
"1.yml"
in
conf
]
load_config_and_play
(
configurations
=
full_confs
)
# configuration_random = random.randint(0, len(configuration_files))
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