mettagrid 0.0.1__py3-none-any.whl → 0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mettagrid might be problematic. Click here for more details.
- README.md +2 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/actions.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/attack.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/gift.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/move.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/rotate.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/shield.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/use.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/mettagrid_c.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects.cpython-311-darwin.so +0 -0
- build/mettagrid/actions/actions.cpp +33353 -0
- build/mettagrid/actions/attack.cpp +32849 -0
- build/mettagrid/actions/gift.cpp +32343 -0
- build/mettagrid/actions/move.cpp +32451 -0
- build/mettagrid/actions/rotate.cpp +32389 -0
- build/mettagrid/actions/shield.cpp +32374 -0
- build/mettagrid/actions/use.cpp +32786 -0
- build/mettagrid/mettagrid.cpp +35202 -0
- build/mettagrid/objects.cpp +35458 -0
- mettagrid/actions/actions.cpython-311-darwin.so +0 -0
- mettagrid/actions/attack.cpython-311-darwin.so +0 -0
- mettagrid/actions/gift.cpython-311-darwin.so +0 -0
- mettagrid/actions/move.cpython-311-darwin.so +0 -0
- mettagrid/actions/rotate.cpython-311-darwin.so +0 -0
- mettagrid/actions/shield.cpython-311-darwin.so +0 -0
- mettagrid/actions/use.cpython-311-darwin.so +0 -0
- mettagrid/actions.cpython-311-darwin.so +0 -0
- mettagrid/mettagrid_c.cpython-311-darwin.so +0 -0
- mettagrid/objects.cpython-311-darwin.so +0 -0
- mettagrid-0.0.2.dist-info/LICENSE +21 -0
- {mettagrid-0.0.1.dist-info → mettagrid-0.0.2.dist-info}/METADATA +1 -1
- mettagrid-0.0.2.dist-info/RECORD +70 -0
- setup.py +90 -0
- test_perf.py +107 -0
- mettagrid-0.0.1.dist-info/RECORD +0 -38
- /mettagrid-0.0.1.dist-info/LICENSE → /LICENSE +0 -0
- {mettagrid-0.0.1.dist-info → mettagrid-0.0.2.dist-info}/WHEEL +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 David Bloomin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
LICENSE,sha256=_0ZygdDOImEUQjXap6LgAetwhuvlOfOqcMDmNlAdjLo,1070
|
|
2
|
+
README.md,sha256=IZPe0D8-9bjNS7FkmKHiGWgR5UIvLsAwIknisM63vLY,58
|
|
3
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/actions.cpython-311-darwin.so,sha256=1lmcaoqbEbeeaIpfXPwhn31QvxBfzbNB0tUTrBrQ56M,218304
|
|
4
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/attack.cpython-311-darwin.so,sha256=1JG53b5UX4Dl4Jofa0z5_iYgjiHbq-jO1jkjoIwutAQ,217296
|
|
5
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/gift.cpython-311-darwin.so,sha256=aHYeQ_F-VZgn5BHpYRdzqfep5-t-TUai3LVqi4I5qDk,216872
|
|
6
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/move.cpython-311-darwin.so,sha256=lGL4fng87SmWEg2haer2svO8HGra4rsNx3luPHCMogQ,216872
|
|
7
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/rotate.cpython-311-darwin.so,sha256=l9fT5qxqFzU83vBa2b0KvN3vKACZsFG6aCX1GP8PTC4,216944
|
|
8
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/shield.cpython-311-darwin.so,sha256=xWcwjFA8RfVTROGcChwr_Uyj_pZIGoPAGmt8zEYNr0Q,216944
|
|
9
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/use.cpython-311-darwin.so,sha256=_He274Fdg3yOIOJ9qfVmHyiaS4ZysFaWzxT2Z9c3wTs,217032
|
|
10
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/mettagrid_c.cpython-311-darwin.so,sha256=9GqMtAnIlwjrpQ4aG5y0Apw6VvnNKy17gll94u9AlQw,257024
|
|
11
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects.cpython-311-darwin.so,sha256=5RgBmm284S3qjzcgINFr4ZdPtEn5UvvrI_ByEXj8USE,238144
|
|
12
|
+
build/mettagrid/actions/actions.cpp,sha256=6PiIfE-eBgZyQP-A9BXKQdzBXtKlRNGrePgBQQNqTDY,1271012
|
|
13
|
+
build/mettagrid/actions/attack.cpp,sha256=A9St0cO7fM-yP-wwfWS-T7ZiqiM7a2LJcVaDdGVwe-A,1248679
|
|
14
|
+
build/mettagrid/actions/gift.cpp,sha256=-0a_xZnO4I3-US0tjFlSRzyvPbPB9F-rhDTSGmVQ5KY,1224492
|
|
15
|
+
build/mettagrid/actions/move.cpp,sha256=FOctJgCVEp4KbRI0oHhOOdVLeYHZA6na0h8GOiye_-E,1228772
|
|
16
|
+
build/mettagrid/actions/rotate.cpp,sha256=0KlTUxyiGOTxtZsnK3uhOxAYvQlkB-6XGP70XC8GnG0,1226329
|
|
17
|
+
build/mettagrid/actions/shield.cpp,sha256=6fY0F-XBnn1PtT7dJ_rlQWelBPwflQ3HvKiTe98LDsM,1225924
|
|
18
|
+
build/mettagrid/actions/use.cpp,sha256=5tSHyx0KFxMF-tcsGVAVd56ykoLNOwDTeYLYHA2AVeA,1244286
|
|
19
|
+
build/mettagrid/mettagrid.cpp,sha256=dZRZkwwEB19HpEzwhttaZZukk5P5Ha5CRAA8BknlsFg,1356096
|
|
20
|
+
build/mettagrid/objects.cpp,sha256=xtKS2bnBsonMgz0Rrj_fA-L7MtiWCu_Qbh-CpE6e4pA,1363437
|
|
21
|
+
mettagrid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
+
mettagrid/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
+
mettagrid/actions/actions.cpython-311-darwin.so,sha256=1lmcaoqbEbeeaIpfXPwhn31QvxBfzbNB0tUTrBrQ56M,218304
|
|
24
|
+
mettagrid/actions/actions.pxd,sha256=Zd9CpuIEWytp1z-KCcuAUoev7dgR16kgea92p8yodps,765
|
|
25
|
+
mettagrid/actions/actions.pyx,sha256=wRg4-3lANoUAIWo6cIAB33AOiPNFg8-EfdCwn-riGP0,1622
|
|
26
|
+
mettagrid/actions/attack.cpython-311-darwin.so,sha256=1JG53b5UX4Dl4Jofa0z5_iYgjiHbq-jO1jkjoIwutAQ,217296
|
|
27
|
+
mettagrid/actions/attack.pxd,sha256=2VQADMYLj7-EhzVoK1_4w_rJFTnj7l7-5fMHseBqGP8,135
|
|
28
|
+
mettagrid/actions/attack.pyx,sha256=dnYTMqNEDa5QX6Btz2shPzW3DBB6Y91Uehr_IbfNQP8,2561
|
|
29
|
+
mettagrid/actions/gift.cpython-311-darwin.so,sha256=aHYeQ_F-VZgn5BHpYRdzqfep5-t-TUai3LVqi4I5qDk,216872
|
|
30
|
+
mettagrid/actions/gift.pxd,sha256=f4Y8mQtBhBlD0z_auZQrRs3StYO54TV2fUw5WSDFnG4,105
|
|
31
|
+
mettagrid/actions/gift.pyx,sha256=YXRCP3dYATIWVYDroRjVip1wGyi4ZQx1f9Jfr9k6uZQ,748
|
|
32
|
+
mettagrid/actions/move.cpython-311-darwin.so,sha256=lGL4fng87SmWEg2haer2svO8HGra4rsNx3luPHCMogQ,216872
|
|
33
|
+
mettagrid/actions/move.pxd,sha256=GN_4ieZrI6RoY92igO4PmayRIS9O-zQl1oeOfImneeE,105
|
|
34
|
+
mettagrid/actions/move.pyx,sha256=8onrsk0jplTOe6OykYw0OdQM9aWzffVyv3pw1Wb2HCg,1206
|
|
35
|
+
mettagrid/actions/rotate.cpython-311-darwin.so,sha256=l9fT5qxqFzU83vBa2b0KvN3vKACZsFG6aCX1GP8PTC4,216944
|
|
36
|
+
mettagrid/actions/rotate.pxd,sha256=z2D17nFORP9lw2eZLZB96KE18sy_d914x0pe854O7MU,107
|
|
37
|
+
mettagrid/actions/rotate.pyx,sha256=fUaWcLnw0s_utXGfmPWg-SzUDw27ma_tsUso23fpayQ,891
|
|
38
|
+
mettagrid/actions/shield.cpython-311-darwin.so,sha256=xWcwjFA8RfVTROGcChwr_Uyj_pZIGoPAGmt8zEYNr0Q,216944
|
|
39
|
+
mettagrid/actions/shield.pxd,sha256=9lf9UOWml8koteofGGTTUyLR20dhE8YTFtZZlMAI7hA,107
|
|
40
|
+
mettagrid/actions/shield.pyx,sha256=D4h-vsbVNbG87n5eiIYs2BsXIKQIWgZe3geKEd7j-ZA,834
|
|
41
|
+
mettagrid/actions/use.cpython-311-darwin.so,sha256=_He274Fdg3yOIOJ9qfVmHyiaS4ZysFaWzxT2Z9c3wTs,217032
|
|
42
|
+
mettagrid/actions/use.pxd,sha256=bFx5IlWzX8mZemv1A5tAg6h97Vt6ev9SSJXewqK33CQ,104
|
|
43
|
+
mettagrid/actions/use.pyx,sha256=tHuNx4JdTf3-50_0S_A4Walgo2PZnRaEBuy9CTYA5YY,2623
|
|
44
|
+
mettagrid/actions.cpython-311-darwin.so,sha256=sXn_0Envaw15TqmGSfSvLE8TKEDI0sUrNbDbfIJU2KQ,238368
|
|
45
|
+
mettagrid/config/game_builder.py,sha256=f9fS38WaXepiwL9qlWqMBI4aMRjKN11P18Q6mFl2yAM,3360
|
|
46
|
+
mettagrid/config/sample_config.py,sha256=BbRqT5hrPY5VKGIC7bVbEjwd_G59defru573KxvCtEA,822
|
|
47
|
+
mettagrid/mettagrid.pyx,sha256=jgzXf6cO7IjHsDn2d_0Za9rgn_SngQNGmOwk7FzMyYE,2667
|
|
48
|
+
mettagrid/mettagrid_c.cpython-311-darwin.so,sha256=9GqMtAnIlwjrpQ4aG5y0Apw6VvnNKy17gll94u9AlQw,257024
|
|
49
|
+
mettagrid/mettagrid_env.py,sha256=NrP8ZuX75JDO-UMa_BOdNKvdz-lqPogEbICRO30Ru4Q,6677
|
|
50
|
+
mettagrid/objects.cpython-311-darwin.so,sha256=5RgBmm284S3qjzcgINFr4ZdPtEn5UvvrI_ByEXj8USE,238144
|
|
51
|
+
mettagrid/objects.pxd,sha256=_71dLM1W9K5WtwMZj35XpzzjDWZkMCiZep75EOAoXbc,5842
|
|
52
|
+
mettagrid/objects.pyx,sha256=CTfc4CQ_NeXkO0LjH_OY8mC4FAluyThKfzn0wzmIHvQ,2197
|
|
53
|
+
mettagrid/renderer/assets/ore-0.png,sha256=_vHlTbCy_NZYzYnkLxdRwF-zp1D2H4Md3yI8-ZX8QGA,376
|
|
54
|
+
mettagrid/renderer/assets/ore-1.png,sha256=HT--nGPU05Wdk1JKNP1rmBYttPbOkWKOI6J-VDs3jwk,384
|
|
55
|
+
mettagrid/renderer/assets/ore-2.png,sha256=Nhn_6IEmPuq9t0rDaCvyPCvpdzX3vZB-X1EoMSpvNvc,425
|
|
56
|
+
mettagrid/renderer/assets/ore-3.png,sha256=-Lt-cyIxZMDX_I7vG6w20MInah8CEorE5WGN0rmVP_k,427
|
|
57
|
+
mettagrid/renderer/assets/ore-4.png,sha256=vySYN37jPtFeTXXmpyJCCalkR0K2RfutIHp8CXgImjg,410
|
|
58
|
+
mettagrid/renderer/assets/ore-5.png,sha256=KSvduI7HnGD4ky3Cq27FwbwHe9pO4-WY1yFoh7mAzCM,410
|
|
59
|
+
mettagrid/renderer/assets/ore-6.png,sha256=6GWdbQJ4P5WLsTz8rWpGtXbc6P7JJ-bO7ze3qHQ4bH0,418
|
|
60
|
+
mettagrid/renderer/assets/puffer_chars.png,sha256=6FaTd_z6JkMldwlYAW94BajgaaGz30ScWBTmUggxu78,71193
|
|
61
|
+
mettagrid/renderer/assets/tiny_galaxy_items.png,sha256=zRfEkwGZ-BnzzCqyse6wyWIGTcteVt_eJVRkTlS4XBA,24116
|
|
62
|
+
mettagrid/renderer/assets/tiny_galaxy_monsters.png,sha256=Aw2Ktj-1BtugmjMI9Wnyb4xxAxq6rzD0mgk9IBdkCyM,32763
|
|
63
|
+
mettagrid/renderer/assets/wall1-0.png,sha256=MONt_xbscHfODf9T9hiy8poHX_TkMXbk_dC6T0ora7I,1155
|
|
64
|
+
mettagrid/renderer/raylib_client.py,sha256=LVZVwHUFlFzDBty2FSWHe5RmR0FPFm-MqA49yTgx81M,6011
|
|
65
|
+
setup.py,sha256=rbuphBIxMYONF0eHq3OaidEoWt86BhX2-XUOm4YWJjE,2480
|
|
66
|
+
test_perf.py,sha256=b4NA2hEpHkxb6s9ijD2mhHtjMYBI0eFYBC5H-R3AqhQ,3233
|
|
67
|
+
mettagrid-0.0.2.dist-info/LICENSE,sha256=_0ZygdDOImEUQjXap6LgAetwhuvlOfOqcMDmNlAdjLo,1070
|
|
68
|
+
mettagrid-0.0.2.dist-info/METADATA,sha256=dorBaDiXY9jHggX9GXjCOKxJu0Gz_jLzNerMqZD8GFo,815
|
|
69
|
+
mettagrid-0.0.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
70
|
+
mettagrid-0.0.2.dist-info/RECORD,,
|
setup.py
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
from sympy import li
|
|
2
|
+
from setuptools import Extension, setup, find_packages, Command
|
|
3
|
+
import subprocess
|
|
4
|
+
from Cython.Build import cythonize
|
|
5
|
+
import numpy
|
|
6
|
+
import os
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def build_ext(srcs, module_name=None):
|
|
10
|
+
if module_name is None:
|
|
11
|
+
module_name = srcs[0].replace("/", ".").replace(".pyx", "").replace(".cpp", "")
|
|
12
|
+
return Extension(
|
|
13
|
+
module_name,
|
|
14
|
+
srcs,
|
|
15
|
+
# include_dirs=["third_party/puffergrid"],
|
|
16
|
+
define_macros=[('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')],
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
ext_modules = [
|
|
20
|
+
build_ext(["mettagrid/objects.pyx"]),
|
|
21
|
+
build_ext(["mettagrid/actions/actions.pyx"]),
|
|
22
|
+
build_ext(["mettagrid/actions/attack.pyx"]),
|
|
23
|
+
build_ext(["mettagrid/actions/gift.pyx"]),
|
|
24
|
+
build_ext(["mettagrid/actions/move.pyx"]),
|
|
25
|
+
build_ext(["mettagrid/actions/rotate.pyx"]),
|
|
26
|
+
build_ext(["mettagrid/actions/shield.pyx"]),
|
|
27
|
+
build_ext(["mettagrid/actions/use.pyx"]),
|
|
28
|
+
build_ext(["mettagrid/mettagrid.pyx"], "mettagrid.mettagrid_c"),
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
debug = os.getenv('DEBUG', '0') == '1'
|
|
32
|
+
annotate = os.getenv('ANNOTATE', '0') == '1'
|
|
33
|
+
|
|
34
|
+
build_dir = 'build'
|
|
35
|
+
if debug:
|
|
36
|
+
build_dir = 'build_debug'
|
|
37
|
+
|
|
38
|
+
os.makedirs(build_dir, exist_ok=True)
|
|
39
|
+
|
|
40
|
+
setup(
|
|
41
|
+
name='metta',
|
|
42
|
+
version='0.1',
|
|
43
|
+
packages=find_packages(),
|
|
44
|
+
install_requires=[
|
|
45
|
+
"hydra-core",
|
|
46
|
+
"jmespath",
|
|
47
|
+
"matplotlib",
|
|
48
|
+
# "numpy==2.0.0",
|
|
49
|
+
"pettingzoo",
|
|
50
|
+
"pufferlib",
|
|
51
|
+
"puffergrid",
|
|
52
|
+
"pynvml",
|
|
53
|
+
"pytest",
|
|
54
|
+
"PyYAML",
|
|
55
|
+
"raylib",
|
|
56
|
+
"rich",
|
|
57
|
+
"scipy",
|
|
58
|
+
"tabulate",
|
|
59
|
+
"tensordict",
|
|
60
|
+
"torchrl",
|
|
61
|
+
],
|
|
62
|
+
entry_points={
|
|
63
|
+
'console_scripts': [
|
|
64
|
+
# If you want to create any executable scripts in your package
|
|
65
|
+
# For example: 'script_name = module:function'
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
include_dirs=[numpy.get_include()],
|
|
69
|
+
ext_modules=cythonize(
|
|
70
|
+
ext_modules,
|
|
71
|
+
build_dir='build',
|
|
72
|
+
compiler_directives={
|
|
73
|
+
"language_level": "3",
|
|
74
|
+
"embedsignature": debug,
|
|
75
|
+
"annotation_typing": debug,
|
|
76
|
+
"cdivision": debug,
|
|
77
|
+
"boundscheck": debug,
|
|
78
|
+
"wraparound": debug,
|
|
79
|
+
"initializedcheck": debug,
|
|
80
|
+
"nonecheck": debug,
|
|
81
|
+
"overflowcheck": debug,
|
|
82
|
+
"overflowcheck.fold": debug,
|
|
83
|
+
"profile": debug,
|
|
84
|
+
"linetrace": debug,
|
|
85
|
+
"c_string_encoding": "utf-8",
|
|
86
|
+
"c_string_type": "str",
|
|
87
|
+
},
|
|
88
|
+
annotate=debug or annotate,
|
|
89
|
+
),
|
|
90
|
+
)
|
test_perf.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import time
|
|
2
|
+
|
|
3
|
+
import hydra
|
|
4
|
+
import numpy as np
|
|
5
|
+
from tqdm import tqdm
|
|
6
|
+
import pandas as pd
|
|
7
|
+
|
|
8
|
+
global actions
|
|
9
|
+
global env
|
|
10
|
+
|
|
11
|
+
def test_performance(env, actions, duration):
|
|
12
|
+
tick = 0
|
|
13
|
+
num_actions = actions.shape[0]
|
|
14
|
+
start = time.time()
|
|
15
|
+
with tqdm(total=duration, desc="Running performance test") as pbar:
|
|
16
|
+
while time.time() - start < duration:
|
|
17
|
+
atns = actions[tick % num_actions]
|
|
18
|
+
obs, rewards, terminated, truncated, infos = env.step(atns)
|
|
19
|
+
tick += 1
|
|
20
|
+
if tick % 100 == 0:
|
|
21
|
+
pbar.update(time.time() - start - pbar.n)
|
|
22
|
+
|
|
23
|
+
print_stats(env._c_env.get_episode_stats())
|
|
24
|
+
print(f'SPS: {atns.shape[0] * tick / (time.time() - start):.2f}')
|
|
25
|
+
|
|
26
|
+
actions = {}
|
|
27
|
+
env = {}
|
|
28
|
+
@hydra.main(version_base=None, config_path="configs", config_name="a20_40x40")
|
|
29
|
+
def main(cfg):
|
|
30
|
+
# Run with c profile
|
|
31
|
+
from cProfile import run
|
|
32
|
+
global env
|
|
33
|
+
|
|
34
|
+
cfg.env.game.max_steps = 999999999
|
|
35
|
+
env = hydra.utils.instantiate(cfg.env, render_mode="human")
|
|
36
|
+
env.reset()
|
|
37
|
+
global actions
|
|
38
|
+
num_agents = cfg.env.game.num_agents
|
|
39
|
+
actions = np.random.randint(0, env.action_space.nvec, (1024, num_agents, 2), dtype=np.uint32)
|
|
40
|
+
|
|
41
|
+
env._c_env.render()
|
|
42
|
+
test_performance(env, actions, 5)
|
|
43
|
+
# env._c_env.render()
|
|
44
|
+
exit(0)
|
|
45
|
+
|
|
46
|
+
run("test_performance(env, actions, 10)", 'stats.profile')
|
|
47
|
+
import pstats
|
|
48
|
+
from pstats import SortKey
|
|
49
|
+
p = pstats.Stats('stats.profile')
|
|
50
|
+
p.sort_stats(SortKey.TIME).print_stats(25)
|
|
51
|
+
exit(0)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def print_stats(stats):
|
|
55
|
+
# Extract game_stats
|
|
56
|
+
game_stats = stats["game_stats"]
|
|
57
|
+
|
|
58
|
+
# Extract agent_stats
|
|
59
|
+
agent_stats = stats["agent_stats"]
|
|
60
|
+
|
|
61
|
+
# Calculate total, average, min, and max for each agent stat
|
|
62
|
+
total_agent_stats = {}
|
|
63
|
+
avg_agent_stats = {}
|
|
64
|
+
min_agent_stats = {}
|
|
65
|
+
max_agent_stats = {}
|
|
66
|
+
num_agents = len(agent_stats)
|
|
67
|
+
|
|
68
|
+
for agent_stat in agent_stats:
|
|
69
|
+
for key, value in agent_stat.items():
|
|
70
|
+
if key not in total_agent_stats:
|
|
71
|
+
total_agent_stats[key] = 0
|
|
72
|
+
min_agent_stats[key] = float('inf')
|
|
73
|
+
max_agent_stats[key] = float('-inf')
|
|
74
|
+
total_agent_stats[key] += value
|
|
75
|
+
if value < min_agent_stats[key]:
|
|
76
|
+
min_agent_stats[key] = value
|
|
77
|
+
if value > max_agent_stats[key]:
|
|
78
|
+
max_agent_stats[key] = value
|
|
79
|
+
|
|
80
|
+
for key, value in total_agent_stats.items():
|
|
81
|
+
avg_agent_stats[key] = value / num_agents
|
|
82
|
+
|
|
83
|
+
# Sort the keys alphabetically
|
|
84
|
+
sorted_keys = sorted(total_agent_stats.keys())
|
|
85
|
+
|
|
86
|
+
# Create DataFrame for game_stats
|
|
87
|
+
game_stats_df = pd.DataFrame(sorted(game_stats.items()), columns=["Stat", "Value"])
|
|
88
|
+
|
|
89
|
+
# Create DataFrame for agent stats
|
|
90
|
+
agent_stats_df = pd.DataFrame({
|
|
91
|
+
"Stat": sorted_keys,
|
|
92
|
+
"Total": [total_agent_stats[key] for key in sorted_keys],
|
|
93
|
+
"Average": [avg_agent_stats[key] for key in sorted_keys],
|
|
94
|
+
"Min": [min_agent_stats[key] for key in sorted_keys],
|
|
95
|
+
"Max": [max_agent_stats[key] for key in sorted_keys]
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
# Print the DataFrames
|
|
99
|
+
print("\nGame Stats:")
|
|
100
|
+
print(game_stats_df.to_string(index=False))
|
|
101
|
+
|
|
102
|
+
print("\nAgent Stats:")
|
|
103
|
+
print(agent_stats_df.to_string(index=False))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
if __name__ == "__main__":
|
|
107
|
+
main()
|
mettagrid-0.0.1.dist-info/RECORD
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
mettagrid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
mettagrid/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
mettagrid/actions/actions.pxd,sha256=Zd9CpuIEWytp1z-KCcuAUoev7dgR16kgea92p8yodps,765
|
|
4
|
-
mettagrid/actions/actions.pyx,sha256=wRg4-3lANoUAIWo6cIAB33AOiPNFg8-EfdCwn-riGP0,1622
|
|
5
|
-
mettagrid/actions/attack.pxd,sha256=2VQADMYLj7-EhzVoK1_4w_rJFTnj7l7-5fMHseBqGP8,135
|
|
6
|
-
mettagrid/actions/attack.pyx,sha256=dnYTMqNEDa5QX6Btz2shPzW3DBB6Y91Uehr_IbfNQP8,2561
|
|
7
|
-
mettagrid/actions/gift.pxd,sha256=f4Y8mQtBhBlD0z_auZQrRs3StYO54TV2fUw5WSDFnG4,105
|
|
8
|
-
mettagrid/actions/gift.pyx,sha256=YXRCP3dYATIWVYDroRjVip1wGyi4ZQx1f9Jfr9k6uZQ,748
|
|
9
|
-
mettagrid/actions/move.pxd,sha256=GN_4ieZrI6RoY92igO4PmayRIS9O-zQl1oeOfImneeE,105
|
|
10
|
-
mettagrid/actions/move.pyx,sha256=8onrsk0jplTOe6OykYw0OdQM9aWzffVyv3pw1Wb2HCg,1206
|
|
11
|
-
mettagrid/actions/rotate.pxd,sha256=z2D17nFORP9lw2eZLZB96KE18sy_d914x0pe854O7MU,107
|
|
12
|
-
mettagrid/actions/rotate.pyx,sha256=fUaWcLnw0s_utXGfmPWg-SzUDw27ma_tsUso23fpayQ,891
|
|
13
|
-
mettagrid/actions/shield.pxd,sha256=9lf9UOWml8koteofGGTTUyLR20dhE8YTFtZZlMAI7hA,107
|
|
14
|
-
mettagrid/actions/shield.pyx,sha256=D4h-vsbVNbG87n5eiIYs2BsXIKQIWgZe3geKEd7j-ZA,834
|
|
15
|
-
mettagrid/actions/use.pxd,sha256=bFx5IlWzX8mZemv1A5tAg6h97Vt6ev9SSJXewqK33CQ,104
|
|
16
|
-
mettagrid/actions/use.pyx,sha256=tHuNx4JdTf3-50_0S_A4Walgo2PZnRaEBuy9CTYA5YY,2623
|
|
17
|
-
mettagrid/config/game_builder.py,sha256=f9fS38WaXepiwL9qlWqMBI4aMRjKN11P18Q6mFl2yAM,3360
|
|
18
|
-
mettagrid/config/sample_config.py,sha256=BbRqT5hrPY5VKGIC7bVbEjwd_G59defru573KxvCtEA,822
|
|
19
|
-
mettagrid/mettagrid.pyx,sha256=jgzXf6cO7IjHsDn2d_0Za9rgn_SngQNGmOwk7FzMyYE,2667
|
|
20
|
-
mettagrid/mettagrid_env.py,sha256=NrP8ZuX75JDO-UMa_BOdNKvdz-lqPogEbICRO30Ru4Q,6677
|
|
21
|
-
mettagrid/objects.pxd,sha256=_71dLM1W9K5WtwMZj35XpzzjDWZkMCiZep75EOAoXbc,5842
|
|
22
|
-
mettagrid/objects.pyx,sha256=CTfc4CQ_NeXkO0LjH_OY8mC4FAluyThKfzn0wzmIHvQ,2197
|
|
23
|
-
mettagrid/renderer/assets/ore-0.png,sha256=_vHlTbCy_NZYzYnkLxdRwF-zp1D2H4Md3yI8-ZX8QGA,376
|
|
24
|
-
mettagrid/renderer/assets/ore-1.png,sha256=HT--nGPU05Wdk1JKNP1rmBYttPbOkWKOI6J-VDs3jwk,384
|
|
25
|
-
mettagrid/renderer/assets/ore-2.png,sha256=Nhn_6IEmPuq9t0rDaCvyPCvpdzX3vZB-X1EoMSpvNvc,425
|
|
26
|
-
mettagrid/renderer/assets/ore-3.png,sha256=-Lt-cyIxZMDX_I7vG6w20MInah8CEorE5WGN0rmVP_k,427
|
|
27
|
-
mettagrid/renderer/assets/ore-4.png,sha256=vySYN37jPtFeTXXmpyJCCalkR0K2RfutIHp8CXgImjg,410
|
|
28
|
-
mettagrid/renderer/assets/ore-5.png,sha256=KSvduI7HnGD4ky3Cq27FwbwHe9pO4-WY1yFoh7mAzCM,410
|
|
29
|
-
mettagrid/renderer/assets/ore-6.png,sha256=6GWdbQJ4P5WLsTz8rWpGtXbc6P7JJ-bO7ze3qHQ4bH0,418
|
|
30
|
-
mettagrid/renderer/assets/puffer_chars.png,sha256=6FaTd_z6JkMldwlYAW94BajgaaGz30ScWBTmUggxu78,71193
|
|
31
|
-
mettagrid/renderer/assets/tiny_galaxy_items.png,sha256=zRfEkwGZ-BnzzCqyse6wyWIGTcteVt_eJVRkTlS4XBA,24116
|
|
32
|
-
mettagrid/renderer/assets/tiny_galaxy_monsters.png,sha256=Aw2Ktj-1BtugmjMI9Wnyb4xxAxq6rzD0mgk9IBdkCyM,32763
|
|
33
|
-
mettagrid/renderer/assets/wall1-0.png,sha256=MONt_xbscHfODf9T9hiy8poHX_TkMXbk_dC6T0ora7I,1155
|
|
34
|
-
mettagrid/renderer/raylib_client.py,sha256=LVZVwHUFlFzDBty2FSWHe5RmR0FPFm-MqA49yTgx81M,6011
|
|
35
|
-
mettagrid-0.0.1.dist-info/LICENSE,sha256=_0ZygdDOImEUQjXap6LgAetwhuvlOfOqcMDmNlAdjLo,1070
|
|
36
|
-
mettagrid-0.0.1.dist-info/METADATA,sha256=ya2_hp-_kRW07IY0CXD5gvIiyK-l5OpzoaCwGIjJR5Q,815
|
|
37
|
-
mettagrid-0.0.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
38
|
-
mettagrid-0.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|