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
0c9b3678
Commit
0c9b3678
authored
May 11, 2020
by
Benjamin
Browse files
revert some changes to the notebooks
parent
32d57486
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
examples/environment_tutorial.ipynb
View file @
0c9b3678
This diff is collapsed.
Click to expand it.
examples/load_tmp.py
0 → 100644
View file @
0c9b3678
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))
examples/training_tutorial.ipynb
View file @
0c9b3678
...
...
@@ -233,7 +233,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.
7.5
"
"version": "3.
6.9
"
}
},
"nbformat": 4,
...
...
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