Fast CoreWars redcode simulator, python bindings.
Project description
Py-Exhaust-MA
Exhaust-MA is a highly optimized Redcode simulator. Py-Exhaust-MA is the python bindings for Exhaust-MA.
Installation
Use pip to install Py-Exhaust-MA.
pip install exhaust-ma
Usage
from exhaust_ma import Warrior, Core, CoreSettings
jaguar = "jaguar.rc"
imp = "imp.rc"
cs = CoreSettings()
w1 = Warrior.from_filename(cs, jaguar)
w2 = Warrior.from_filename(cs, imp)
c = Core(cs)
c.load_warriors([w1, w2])
print(c.run())
Exhaust-MA includes a set of warriors which you can access using importlib.resources:
import importlib.resources
jaguar = importlib.resources.files("exhaust_ma") / "exhaust-ma" / "jaguar.rc"
A full list of included files can be found In the exhaust-MA repository.
Contributing
To get going:
# Clone the git repository
git clone git@github.com:SuperDoxin/py-exhaust-ma.git
cd py-exhaust-ma
# Update the submodules. This is needed for building the exhaust-ma cffi
# library
git submodule init
git submodule update
# Activate pre-commit hooks
pre-commit install
At this point running
uv run -m exhaust_ma
Should output
BattleResult(dead=[Warrior(name='imp.rc')], alive={Warrior(name='jaguar.rc')})
If it doesn't something has gone wrong, If you need further assistance open an issue and include all the output of all the commands you have run and I'll see what I can do.
Pull requests are more than welcome. As long as you've installed the pre-commit hooks most code style issues should be checked automatically.
Updating/adding tests is appreciated but by no means a requirement for a PR to get accepted.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file exhaust_ma-0.0.4.tar.gz.
File metadata
- Download URL: exhaust_ma-0.0.4.tar.gz
- Upload date:
- Size: 51.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cade8937b31d2772b10854a5441aacafbad1a5d33ae92679c7a85d1042c7a836
|
|
| MD5 |
9a51fa032a46e968306edcabe4c7c5ad
|
|
| BLAKE2b-256 |
2224f8c8da9555c4278e8fd967c5984cbe3d450ba28d1becfe619656f158448a
|