Minimal Kriegspiel random-move bot.
- registers with the Kriegspiel API
- authenticates with a bot bearer token
- polls assigned games
- can keep one open human-joinable lobby game advertised
- can also join another bot's waiting lobby game with 50% probability when one is available
- picks random kriegspiel-allowed moves exposed by the API
- intentionally caps itself at 5 active games in parallel
- keeps running through transient API failures
Set KRIEGSPIEL_BOT_OWNER_EMAIL in .env before registering. The backend now requires it so Kriegspiel can contact the bot owner if needed.
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
python bot.py --register
python bot.pyBy default the bot also keeps one open lobby game available for humans to join. That behavior is controlled with:
KRIEGSPIEL_AUTO_CREATE_LOBBY_GAME=true|falseKRIEGSPIEL_AUTO_CREATE_RULE_VARIANT=berkeley|berkeley_any|cincinnati|wild16|rand|english|crazykriegKRIEGSPIEL_AUTO_CREATE_PLAY_AS=white|black|randomKRIEGSPIEL_MAX_ACTIVE_GAMES=5KRIEGSPIEL_SUPPORTED_RULE_VARIANTS=berkeley,berkeley_any,cincinnati,wild16,rand,english,crazykrieg
The bot will not intentionally create or join beyond 5 active games in parallel.
Bot-vs-bot play is also enabled by default:
- the bot samples open waiting games at most once per minute
- it will only consider games created by another bot
- it will try to join one with 50% probability on a poll cycle
- it keeps the local cooldown even when no join candidate is found, matching backend bot-join limits and avoiding tight lobby scans
pip install -r requirements-dev.txt
python -m unittest discover -s tests
python -m coverage run -m unittest discover -s tests
python -m coverage report -mA production host can run the bot as a service with deploy/kriegspiel-random-bot.service.