Skip to content
melvincarvalhoPublic

About

Web bridge game — solo vs robots, online tables, double-dummy analysis. Decentralized identity (Nostr/Solid).

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Bridge

Mind map

A web bridge game. Goal: parity with BBO, then better — decentralized identity (nostr / NIP-98), signed portable results, and first-class learning/analysis.

Current state

  • Solo: you sit South against robots playing a simple natural system (openings, responses, overcalls, rebids; drawing trumps, sensible leads). Claim, undo, session score sheet, double-dummy analysis after every board (par, makeable-contracts table, DD optimum vs actual) and IMPs vs par. Session persists across refresh.
  • Online: thin WebSocket server (same engine) hosting tables — create a table, share the id, friends take seats, robots fill the rest. Server deals and keeps hands hidden; every action is validated server-side. Identity via xlogin (Nostr NIP-07 / Solid) with guest fallback.
npm install
npm start          # play at http://localhost:8787 (client + game server, one process)
npm test           # engine unit + integration tests

No build step: the client is plain ES modules served straight from src/ (plus vendor/bridge-dds/ for the double-dummy WASM solver). Production is the same single process serving the client and the WebSocket on one port. Deploying is that plus TLS termination (e.g. caddy/nginx) and optionally Ben below. Dropped connections keep their seat for 5 minutes; reloading the page reclaims it automatically.

The game also mounts inside a JavaScript Solid Server so pod and nostr identities sign in through the host's own auth (node jss-plugin/serve.js — see jss-plugin/NOTES.md for the findings).

Ben — real robot AI (optional)

Online-table robots can be driven by Ben, a neural-network bridge engine, instead of the built-in heuristics:

scripts/ben-setup.sh                                  # one-time (~4 GB, no root needed)
scripts/ben-start.sh &                                # REST API on :8085 (~30s to load)
BEN_URL=http://localhost:8085 npm run server          # robots now bid & play via Ben

Any Ben error or timeout falls back to the heuristic bots for that single decision, so tables never stall. Ben also returns bid explanations ("5+ !S; 11-20 HCP") — not surfaced in the UI yet.

Layout

  • src/engine/ — pure JavaScript rules engine, no framework dependencies: deal, auction, play, duplicate scoring, plus a placeholder robot. This is the foundation for everything later (server, multiplayer, bots).
  • src/ui/ — vanilla DOM render helpers: table, hands, bidding box, auction history (state object + render functions + event listeners).
  • tests/ — engine tests, including an integration test that plays 50 random boards to completion.

Roadmap

  1. Core engine + solo table vs robots
  2. Double-dummy analysis via DDS compiled to WASM (LIN/PBN import still open)
  3. Tables with friends: thin server, WebSockets, xlogin identity (first cut)
  4. Real robot (Ben) behind a provider interface (online tables; solo still heuristic)
  5. Signed login (NIP-98 tickets), table chat, online analysis/review
  6. Deploy publicly
  7. Kibitzing, disclosure UX (alerts, own-bid explanations), LIN/PBN import
  8. Duplicate tournaments, matchpoints across tables, results as signed nostr events

About

Web bridge game — solo vs robots, online tables, double-dummy analysis. Decentralized identity (Nostr/Solid).

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages