Metadata-Version: 2.4
Name: dungeoncoder
Version: 0.2.2
Summary: Python API for Dungeon Coder: steer the hero from a script, in VS Code or in the built-in simulator
License-Expression: MIT
Project-URL: Homepage, https://github.com/mhobelsb/vsc_hm-dungeon-coder
Project-URL: Issues, https://github.com/mhobelsb/vsc_hm-dungeon-coder/issues
Classifier: Programming Language :: Python :: 3
Classifier: Intended Audience :: Education
Classifier: Topic :: Education
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: httpx>=0.27
Requires-Dist: attrs>=23.1
Dynamic: license-file

# dungeoncoder

The Python API for [Dungeon Coder](https://github.com/mhobelsb/vsc_hm-dungeon-coder), a VS Code extension in which a Python script steers a hero through a pixel-art dungeon.

```python
from dungeoncoder import Game

game = Game("playground.json")
hero = game.get_hero()
while not hero.is_at_goal():
    if hero.is_collision_in_front():
        hero.turn_left()
    else:
        hero.move()
```

- **With the extension:** start the game in VS Code (`Dungeon Coder: Enter the dungeon`); the script talks to it over a local REST API.
- **Without VS Code:** `dungeoncoder.use_simulator()` (or `DUNGEONCODER_SIM=1`) runs the same script in a pure-Python simulator of the game's rules: no picture, no waiting. `dungeoncoder.testing.spiel(map_text)` gives `(game, hero)` for pytest.
- **Levels from text maps:** `Game("karte.txt")`.
- **Setup check:** `python -m dungeoncoder` says which Python and which copy of the package run, whether the game answers and whether its version fits.

The package has the same version as the extension. Install it with `pip install dungeoncoder`.
