Inspiration

Every game night stalls on the same argument: can you castle out of check? Does a Draw Four stack? Someone digs out a rulebook (or doesn't), and the game stops. I wanted a referee that sits on the table, works with no signal, and answers in seconds with the actual rule.

What it does

Game Ref is an AI game referee. Meet Zeb the Ref:

  • Ask any rules question in plain English (type it, say it, or snap a photo of the board) and Zeb makes the call: YES / NO / IT DEPENDS, with a one-line ruling, a short explanation, and the exact rule sentence quoted so nobody has to take the AI's word for it.
  • 83 games built in: card games, a full poker section (Texas Hold 'em, Omaha, Seven-Card Stud, Razz, Badugi, Pai Gow and more), board, dice and yard games. Rules come from Wikipedia (CC BY-SA) and ship with the app, so they work offline. Any other game: search Wikipedia or upload a PDF rulebook.
  • Learn to play: every game has a how-to-play walkthrough voiced by Zeb: an offline step-through built into the app, plus an HD video when you're online.
  • Throw the challenge flag: don't like the call? Challenge it and Zeb re-checks with the bigger model.

Instant, cited rulings

Learn to play

83 games built in

How we built it: hybrid by design

  • Firebase AI Logic hybrid inference with PREFER_ON_DEVICE: Gemini Nano answers on your device first (fast, private, offline); Gemini in the cloud takes over only when on-device isn't available or can't produce a valid ruling. The status chip shows which brain made each call.
  • Web: Vite + TypeScript with the Firebase JS SDK (firebase/ai), structured output via responseSchema.
  • Android: a native shell with firebase-ai + firebase-ai-ondevice (Gemini Nano through AICore) using generateObject with a KSP @Generable ruling type.
  • Firebase App Check protects every model call; Firebase Hosting serves the app and the how-to videos.
  • Retrieval: rules are chunked and ranked with BM25 (light stemming) so even a small on-device model only sees the few rule sentences that matter.

Challenges we ran into

  • Small models guess. The fix was generation order: the schema makes Zeb first copy the deciding rule sentence word for word, and only then write the verdict. Castling out of check went from a wrong YES to a correct NO, with the rule quoted.
  • On-device schema limits. Gemini Nano rejected an enum verdict field, so every call silently fell back to the cloud. Making the verdict a constrained string got on-device rulings working on a Galaxy Z Fold7 (a cited NO in about 6.6 s, fully on-device).
  • Foreground only. AICore blocks background use, so on-device calls only run while the app is in front; the app falls back to the cloud gracefully.

What we learned

Hybrid isn't just "offline mode": the on-device model changes how you design prompts, schemas and retrieval. Making the model show its evidence first made both models more accurate and made the answers trustworthy to players.

What's next

More games, house-rules profiles per table, and multi-language rulings.

Try it: https://game-ref-d0107.web.app ยท Code (Apache-2.0): https://github.com/banksythequantLab/game-ref

Built With

Share this project:

Updates

Submission history