A balloon navigation game where you collect dollars while avoiding spikes. Ships with two interfaces: a Flask web app (primary) and a terminal CLI (legacy). Comes with a plug-in bot system and an in-browser bot builder.
Navigate your balloon (O) to collect dollars ($) while avoiding spikes (*). Each dollar you collect spawns a new spike at the old dollar location — the map gets progressively deadlier.
- Web UI — play in the browser, no install on the client side
- Bot demos — watch a gallery of pre-built AI algorithms play
- Bot builder — write and run your own
checkBot(hero)in-browser - Server-side leaderboard — scores persisted in SQLite (
game_scores.db) - Admin panel — PIN-gated view over the raw scores table
- CLI mode — terminal version with menu-driven play
- Python 3.8+
- Git
git clone https://github.com/Bejjoeqq/Hello-Balloons.git
cd Hello-Balloons
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env # then edit the values you care aboutpython web_app.pyOpen http://127.0.0.1:5000 in a browser. The SQLite database is created automatically on first launch.
Default host is
127.0.0.1. To expose on your LAN, setFLASK_HOST=0.0.0.0in.env.
python main.pyTerminal menu for Play / Leaderboard / Bot demo / Exit. Keyboard input is implemented for Windows (msvcrt); on Linux/macOS the arrow-key handler is not wired up — use the web mode instead.
All runtime config is read from environment variables (see .env.example):
| Variable | Default | Purpose |
|---|---|---|
FLASK_SECRET_KEY |
random per boot | Flask session signing key. Set explicitly in production. |
FLASK_DEBUG |
0 |
1 enables Flask debug mode (dev only, do not ship). |
FLASK_HOST |
127.0.0.1 |
Bind address. 0.0.0.0 exposes on LAN. |
FLASK_PORT |
5000 |
HTTP port. |
ADMIN_PIN |
000000 |
PIN required to open the admin panel. |
DATABASE_PATH |
game_scores.db |
SQLite file location. |
Navigate to /admin_panel and enter ADMIN_PIN. The default (000000) is suitable for local development only — set a real value via .env before exposing the app.
- W / A / S / D — move up / left / down / right
- Goal — collect
$while avoiding* - Catch — every
$eaten spawns a new*where the dollar was
Pick a bot from the dropdown and watch it play. Speed is adjustable from Slow to Godspeed.
Write a checkBot(hero) function in the browser editor, validate, then run. Your bot must return one of 'w' | 'a' | 's' | 'd'.
NAME = "My Bot"
def checkBot(hero):
x, y = hero.getLocation() # balloon position
ydollar, xdollar = hero.findLocationDollar() # dollar position
# ... your logic ...
return 'w' # 'w', 'a', 's', or 'd'| Method | Returns |
|---|---|
hero.getLocation() |
[x, y] balloon position |
hero.findLocationDollar() |
[y, x] dollar position |
hero.getMove() |
current direction |
hero.getMap() |
2D list of map cells |
All files in app/bot/ are auto-loaded at start (except template.py). Notable ones: champion_bot, perfect_score_bot, quantum_neural_bot, astar_supreme_bot, hybrid_master_bot.
Hello-Balloons/
├── main.py # CLI entry shim → app.cli.run()
├── web_app.py # Web entry shim → app.web.create_app()
├── app/
│ ├── __init__.py # shared: statePoint(), baseMap()
│ ├── hero.py # shared: Hero class
│ ├── map.py # shared: Map class
│ ├── guide.py # shared: text helpers
│ ├── database.py # GameDatabase (SQLite) — single DB source
│ ├── bot/ # bot registry + built-in bot algorithms
│ │ ├── __init__.py # auto-loader
│ │ ├── template.py # starter template for new bots
│ │ └── *.py # built-in bots
│ ├── cli/ # CLI interface
│ │ ├── __init__.py # run() — menu loop
│ │ ├── prompt.py # terminal key reading
│ │ └── start.py # CLI game loop
│ └── web/ # Flask interface
│ ├── __init__.py # create_app() factory
│ ├── config.py # Config dataclass (env vars)
│ ├── state.py # in-memory session/custom-bot registries
│ ├── session.py # GameSession class
│ ├── bot_executor.py # custom-bot validation + sandboxed exec
│ └── routes.py # Flask blueprint with all 20 routes
├── templates/ # Flask HTML templates
├── .env.example # env var reference
├── .gitignore
├── LICENSE # MIT
├── CONTRIBUTING.md
├── pyproject.toml # PEP 621 metadata + ruff config
├── requirements.txt # runtime deps
└── requirements-dev.txt # dev deps (ruff, pytest)
pip install -r requirements-dev.txt
ruff check . # lintRun the app locally as described in Quick start. The SQLite DB (game_scores.db) is created on first import of app.database; it is git-ignored.
- Copy
app/bot/template.pytoapp/bot/your_bot.py - Set
NAME = "Your Bot"and implementcheckBot(hero) - Restart the server — it's auto-registered on import
- Open
/bot_demoand pick it from the list
Scores are stored server-side in a local SQLite file (game_scores.db by default, overridable via DATABASE_PATH). There is no browser-local-storage leaderboard. The database file is ignored by git — every checkout starts fresh.
- Test suite under
tests/with fixtures forGameDatabase .github/workflows/CI running ruff + pytest- Type hints /
mypypass - Replace in-memory
game_sessionsdict with Redis (for multi-worker deploys) - Harden the custom-bot sandbox (restrict imports, add CPU / wall-time limits)
See CONTRIBUTING.md.
MIT.
- Project developed with AI-assisted tooling for code generation and documentation
- Game concept inspired by classic navigation puzzles
- Thanks to all contributors and bot authors
- GitHub: Bejjoeqq
- Repository: Hello-Balloons