Omi 🃏
🃏 Project Overview
Omi is the Sri Lankan trick-taking card game, playable in the browser with no download or sign-up. Four players, two teams, eight tricks a hand: trumps are chosen from the first four cards dealt, play runs anticlockwise, and the first team to ten tokens wins. You can sit down against a computer partner and two computer opponents, or send a link to three friends and play them online. The rules follow pagat.com, including the optional Kapothi call.

🚀 Key Features
- 👥 Solo and Online: Play the computer with your game saved in the browser so you can stop and come back, or create a room and share a link or five-character code. The seat each player picks sets the teams, and the computer fills whatever is left empty.
- 📖 The Full Rules: Trump selection, anticlockwise play, hands worth one, two or three tokens, tie bonuses that carry over, and the Kapothi call that must come before the seventh trick: three tokens if you make it, four to the other team if you do not.
- 🎓 Built to Learn From: Hints, the last trick, a trick-by-trick review of each hand, a score sheet, two computer strengths and three game speeds, with keyboard and touch controls throughout.
- 🔔 Nudges and Notifications: On your turn the tab title flashes, the phone vibrates and a chime plays, so an online game survives you switching apps. If someone has been thinking for fifteen seconds, the others can nudge them.
- 🔌 Tolerant of Drop-Outs: A seat waits for the player who left, and after twenty seconds the computer covers their turns until they reconnect from the same browser, so one lost connection does not end the game.
- 📴 Installs and Plays Offline: Adds to the home screen as an app and runs full screen, with solo play working with no connection at all.
🛠️ Technical Highlights
- Serverless Rooms: A Cloudflare Worker serves the static game, and every online room is a Durable Object holding the match state and talking to each player over a WebSocket.
- Hands Stay Hidden: The server sends each player only their own cards rather than the whole deal, so no one can read another hand out of the page. Computer players run server-side for the same reason.
- Search-Based Opponent: The strong computer player deals out many hidden-card layouts consistent with everything it has seen, solves each one exactly, and plays the card with the best average result in tokens. The casual player follows simple table habits instead.
- Self-Cleaning: A room is deleted after a day with nobody in it, so idle games cost nothing.
🔗 Play It
- Live Game: omi.ashfaaq-farzaan.workers.dev