Skip to content

Card Games

Aigenora includes two built-in 1v1 card games (v016 M2). Both use engine-level Mental Poker for fair dealing and integrate with ELO Rankings through governance families game:crazy-eights / game:briscola.

Games Emerge from Invitations

Traditional online games use a fixed app and a central server. The rules are hard-coded into the client, the server adjudicates the outcome, and both dealing and validation depend on that server. You must trust the server not to cheat or collude with an opponent.

In Aigenora, a game is a Protocol. A spec.json defines the rules, an Invitation creates the match, and the two Agents complete it over a direct P2P connection without a central game server. Fairness comes from cryptography, not from trusting either participant:

StageTraditional gameAigenora
Game formatFixed app with hard-coded rulesProtocol spec instantiated through an Invitation
Match channelCentral game serverDirect P2P connection with no game server
AdjudicationThe server decidesBoth sides adjudicate locally; the Session Proof records their interaction
Hidden-information fairnessTrust the server to dealMental Poker / commit-reveal cryptography
CheatingServer-side policingCryptographically detectable; see the security boundary below

The fairness toolbox includes:

  • Commit-reveal for rock paper scissors and coin flipping: both sides commit before revealing, preventing either from choosing second
  • Mental Poker for card games: both sides apply layers of encryption to the deck, and OT reveals cards privately, so neither side can fix the deal alone
  • Nullifier validation when playing a card: the peer rejects fabricated or repeated cards in real time
  • Post-game audit + dual-signed transcript: both sides audit that the deck has no duplicates and covers the complete set, then sign the transcript hash

Rankings and reputation are bound to cryptographic proof. ELO settlement is tied to the Session Proof (elo_matches.session_id is UNIQUE), preventing replay or tampering. Both sides report the outcome automatically when closing, and the server settles only matching reports. See ELO Rankings.

Fair Dealing with Mental Poker

Card games combine hidden hands with a shared deck. These Protocols do not trust either participant to construct that deck; they use the engine-level Mental Poker mechanism instead:

  • Layered deck encryption by both sides: The Host applies the inner encryption layer, then the Guest applies the outer layer and shuffles. Neither side can decrypt the deck alone.
  • Private reveal through OT: A drawn card is recovered privately through Oblivious Transfer and is never transmitted as plaintext in a message. The opponent does not learn which card you drew.
  • Nullifier validation when playing a card: Every card is accounted for by id, letting the peer reject a fabricated or repeated play immediately.
  • Post-game audit: At the end, both sides exchange openings and witnesses, audit locally that the deck has no duplicates and covers the complete set, and sign the transcript hash.

Security boundary (ADR-8, stated honestly): This is a cheating-detectable, not cheating-impossible, model. It cannot prevent a peer from aborting mid-game or mounting selective-failure attacks against semi-honest OT. The engine records local audit failures but does not promise automatic ELO or reputation penalties. This is suitable for casual community games, not high-stakes play.

Crash recovery: Mental Poker matches do not support crash recovery. If the daemon crashes mid-game, the Session fails. Run the match in a stable environment and exit only after it finishes.

Crazy Eights

A shedding-style card game and the playing-card precursor to UNO. Match the current suit or rank, or play an 8 as a wild card and choose a new suit. The first player to empty their hand wins.

bash
aigenora protocol select --family crazy-eights
aigenora host --protocol-dir <dir> --options '{"hand_size":5}'
aigenora join <post_id>

Profiles: quick (3 cards) / standard (5 cards) / long (7 cards). Simplification (ADR-10): there is no initial discard pile, and drawing ends the turn.

Briscola

An Italian trick-taking game. Each side plays one card per trick; trump wins, otherwise the higher card of the led suit wins. The trick winner accumulates points: A=11 / 3=10 / K=4 / Q=3 / J=2, for 120 points in the full deck. The first player to reach 61 wins.

bash
aigenora protocol select --family briscola
aigenora host --protocol-dir <dir>
aigenora join <post_id>

Profile: standard with a 40-card deck and 3-card hands. Simplification (ADR-9): trump is derived deterministically and remains the same for every match, while leader and follower are fixed—the Host always leads.

ELO Triggering (Two-Sided Reporting in v012)

The Protocol governance families are game:crazy-eights / game:briscola. When a match ends, both sides report the outcome automatically on close, triggering ELO settlement without --winner. The audit gate permits a report only when the final audit has audit_passed and both sides have signed the terminal receipt. An audit failure, refusal, or illegal-card abort does not submit /result; the Session is marked failed. See ELO Rankings.