Skip to content

Repository files navigation

GraphWar

Live Demo CI Release PyPI License: MIT Python

Function approximation benchmark arena. Plug in a model (fit / predict), configure a task, and compare against baselines with clear metrics, battle cards, tournaments, and a playable Graphwar battlefield in the browser.

Inspired by classic Graphwar — here contestants learn to approximate hidden curves instead of only shooting lines.

Install

pip install graphwar
# optional extras
pip install "graphwar[sklearn,plotly,scipy,dev]"

From source:

git clone https://github.com/AvoCahDoe/GraphWarBenchmark.git
cd GraphWarBenchmark
python -m venv .venv
# Windows
.venv\Scripts\activate
pip install -e ".[dev]"

Quick start

# Team fight (2–3 teams, each with a model)
graphwar fight --config configs/fight.example.yaml

Arena (React)

Home screen is Fight: pick 2–3 teams, each chooses a built-in or custom model, pick battlefield functions, hit Fight.

uvicorn graphwar.api.app:app --reload --host 127.0.0.1 --port 8000
cd frontend && npm install && npm run dev

Open http://127.0.0.1:5173

Live deployment

Service URL
Frontend (Vercel) https://graphwar-sooty.vercel.app
API (Render) https://graphwar-api.onrender.com

The Vercel build sets VITE_API_URL=https://graphwar-api.onrender.com so the SPA calls the Render API cross-origin (CORS enabled). Play Graphwar runs fully in the browser; Fight / Tournament / Leaderboard use the API.

Render free tier spins down after ~15 minutes idle (first request may be slow). Custom contestant file uploads via path do not work on Render’s ephemeral filesystem — use built-in models or deploy with persistent storage.

Config: render.yaml (API), frontend/vercel.json (SPA).

CLI

graphwar fight --config configs/fight.example.yaml
graphwar test-my-model --path examples/my_contestant.py --config configs/quick.yaml
graphwar list-functions --difficulty easy
graphwar run --config configs/default.yaml --out results/

Custom model

Copy examples/my_contestant.py and implement fit / predict. Point YAML contestant_path or the dashboard custom path at your file.

Config presets

  • configs/quick.yaml — fast smoke
  • configs/default.yaml — broader suite
  • configs/custom.example.yaml — your model + baselines
  • configs/fight.example.yaml — multi-team fight

Releases & packages

Artifact Location
GitHub releases Releases
Python package PyPI — graphwar
Frontend Private npm package in frontend/ (built with Vite; served via dev server or static dist/)

Tag a release to publish:

git tag v0.1.0
git push origin v0.1.0

The release workflow builds sdist/wheel, creates a GitHub release, and uploads to PyPI when PYPI_API_TOKEN is configured in repository secrets.

Project links

License

MIT — see LICENSE.

About

Function-approximation arena: fight models, run tournaments, and play Graphwar in the browser

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages