Skip to content

puspak2n/hexarch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HEXARCH

A 7-hex strategy duel. Same opening for everyone today. 10 minutes. No signup, no install — open the URL, pass the phone or share the link, play.

Play: (deploy to Netlify in one drag — see below) Source: single index.html, ~620 lines of vanilla JS, zero dependencies, zero build step.


The game

Two players, one 37-cell hex board, four asymmetric pieces each.

Piece Glyph How it moves
Spire One hex, any direction. Your king — if captured or surrounded by 3+ enemy pieces, you lose.
Drift Slides any distance in a straight line until blocked. Cannot capture.
Warden One hex; if onto an enemy, pushes them back one hex (or captures if no cell behind).
Echo Copies the movement rule of your opponent's last-moved piece.

Win in two ways:

  1. Conquest — land your Spire on the opponent's home cell (the hex with the blue ring).
  2. Encirclement — get 3 of your pieces adjacent to the opponent's Spire.

Black moves first. Hard cap at 60 plies (rare; encirclement or conquest comes first).

The whole rules card fits in 90 seconds of reading. The strategy comes from Echo — every turn you move, you're choosing what verb to gift your opponent next turn.


Why this design

This game came out of a structured 8-persona AI debate (transcript) with the constraints: chess-deep, more fun, multiplayer with friends, plain HTML on Netlify. The room converged on:

  • 7×7 hex board (Hive/Onitama lesson: tiny board, deep emergent strategy)
  • Asymmetric named pieces (Hive: pieces are their movement rules)
  • Perfect-information turn-based (chess: every loss is your fault — earned wins)
  • Daily-seed Wordle-shape (one opening for everyone today, head-to-head against a friend)
  • Single index.html, no backend (frontend constraint)
  • Echo as the novel hook (steel-manned by every persona; chosen because it makes "what verb am I gifting my opponent" the load-bearing decision)

Full design synthesis: see the SYNTHESIS.md in the debate transcript.


How to play locally

Just open index.html in any modern browser. There's no build step. No npm install. Nothing.

git clone https://github.com/puspak2n/hexarch.git
cd hexarch
# Option 1: just open the file
open index.html      # macOS
xdg-open index.html  # Linux
start index.html     # Windows

# Option 2: a tiny local server (any will do)
python3 -m http.server 8000
# then visit http://localhost:8000

Deploy to Netlify (under 2 minutes)

Easiest path — Netlify Drop:

  1. Go to https://app.netlify.com/drop
  2. Drag the entire hexarch/ folder onto the drop zone
  3. Done. You get a https://<random-name>.netlify.app URL immediately.

With a custom subdomain:

  1. After dropping, click Site settings → Change site name → pick hexarch (if available).

With Git auto-deploy:

  1. Sign in to Netlify, Add new site → Import an existing project → GitHub
  2. Select puspak2n/hexarch
  3. Build command: (leave blank) · Publish directory: (leave blank, or .)
  4. Deploy. Every push to main re-deploys automatically.

No build step, no env vars, no functions (yet). The game state lives entirely in the URL hash, so pasting your URL in Discord = sharing your save file.


How the URL state works

After every move, the entire game state is encoded into the URL hash as base64-JSON:

https://hexarch.netlify.app/#g=eyJwIjpbWyJiIiwicyIsMCwzXSxbImIiLCJ3IiwtMSwzXV0...
  • ~250–350 chars typical, well under any URL limit
  • No backend required — refresh the page, the state restores
  • Every URL is a save file — text it to a friend, they pick up exactly where you left off
  • The hashchange listener means typing a different URL hash live-syncs the board (useful for multiplayer-by-text)

Roadmap (Week 2 and beyond)

  • Live mode — ~30-line Cloudflare Worker as WebRTC signaler, two players play synchronously after one URL share
  • Daily Duel emoji share stringHexarch 04-24 ✅ vs Marco 🟩🟨⬛🟩🟨 (12 ply) for Wordle-shape distribution
  • Optimal-line evaluator — precomputed daily, embedded as daily.json (200 bytes), green/yellow/black per move
  • Solo vs. today's seed mode (hot-seat both sides, still get share string, works before friends exist)
  • Animations on move (@keyframes slide)
  • Accessibility — full keyboard nav, ARIA labels, screen-reader move descriptions

Test the rules engine

node test.mjs

Runs 31 logic tests covering: hex geometry, daily seed determinism, all four piece movement rules, win conditions (conquest, encirclement, spire-captured), URL state encode/decode round-trips, and Warden push/capture mechanics.


Files

hexarch/
├── index.html      # the entire game (~620 LOC vanilla JS, embedded CSS)
├── test.mjs        # Node smoke tests for the rules engine
├── README.md
├── LICENSE         # MIT
└── netlify.toml    # tells Netlify to publish the root, no build step

License

MIT. Take it, fork it, rename it, change the pieces, ship a better one.


Credits

Designed by an 8-persona structured AI debate orchestrated through Claude Code and the puspak2n/claude-debate plugin. The personas converged on HEXARCH after rebuttals, cross-examination, and steel-manning — full transcript available on request. Built by @puspak2n.

The Echo mechanic owes a debt to Onitama's swapping cards (Shimpei Sato) and Hive's movement-as-identity philosophy (John Yianni).

About

A 7-hex strategy duel — Spire/Drift/Warden/Echo on a 37-cell board. Same opening for everyone today. Single index.html, no backend, deploy to Netlify in one drag.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors