> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inco.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Worked Examples

> Four full games built on ConfidentialDeck

Each game is small, tested, and built only on the kit. Read them to see the moves
assembled into a real flow. The privacy model differs per game, which is the
point: the kit covers private hands, public reveals, hidden winners, and
per-player secrets.

## War

The smallest game. One private card each, higher rank wins.

* Each player's card is dealt with `_dealTo`, so only they can peek it.
* Both cards reveal at showdown, then settle by comparing verified values.
* Matchmaking uses a rooms array. `join()` seats you at an open table or opens a
  new one, so a busy table never blocks a newcomer.

Source: [`contracts/examples/War.sol`](https://github.com/Inco-fhevm/confidential-deck-template/blob/main/contracts/examples/War.sol)

## Blackjack

Solo play against the house. Private hand, hit loop, public dealer upcard,
reveal-all, attested settle, and a pull payout.

* The player's hand is dealt face-up on purpose. There is no opponent to hide it
  from, and it keeps the UI free of signature prompts.
* The confidential part is the dealer's hole card and the undealt shoe, hidden
  with `_draw` until the player stands.
* Scoring lives in `BlackjackMath.sol`, pure Solidity with no Inco calls, so it
  unit-tests without a covalidator.

Source: [`contracts/examples/Blackjack.sol`](https://github.com/Inco-fhevm/confidential-deck-template/blob/main/contracts/examples/Blackjack.sol)

## Raffle

The kit is not just for cards. One shuffle picks a hidden winner, revealed at the
draw.

* The winning ticket is a hidden draw, unknowable even to the deployer until
  `draw()` reveals it.
* Entrant addresses and ticket numbers are public by nature. Only the outcome is
  secret until reveal.
* `newRound()` reopens for a fresh draw.

Source: [`contracts/examples/Raffle.sol`](https://github.com/Inco-fhevm/confidential-deck-template/blob/main/contracts/examples/Raffle.sol)

## Mafia

Selective reveal. Each player privately learns only their own role.

* Each role is dealt with `_dealTo` to its owner, so only that player can decrypt
  it.
* No role is ever revealed on-chain. Social play happens off-chain.
* `reset()` reopens for a fresh round.

Source: [`contracts/examples/Mafia.sol`](https://github.com/Inco-fhevm/confidential-deck-template/blob/main/contracts/examples/Mafia.sol)

## What stays secret

No plaintext card or role value is ever emitted in an event or stored in the
clear. Contracts hold only `bytes32` handles. Plaintext appears on-chain only at
a deliberate `e.reveal` or `_verifyValue` settlement point. `e.verifyDecryption`
binds the signed value to the stored handle, so a valid attestation for a
different handle cannot be substituted.

| Game      | Secret                            | Public                      |
| --------- | --------------------------------- | --------------------------- |
| War       | each player's card until showdown | table state, the winner     |
| Blackjack | dealer hole card, undealt shoe    | player hand, settled result |
| Raffle    | the winning ticket until the draw | entrants, ticket numbers    |
| Mafia     | each player's role, always        | who is playing              |
