> ## Documentation Index
> Fetch the complete documentation index at: https://hedgeem-api.qeetoto.com/llms.txt
> Use this file to discover all available pages before exploring further.

# F022 — Card Display

> Hole cards dealt face-up for all hands; community cards dealt face-down and revealed per stage

# F022 — Card Display

| Field  | Value                     |
| ------ | ------------------------- |
| ID     | F022                      |
| Phase  | 3 — UI                    |
| Jira   | HEDGE-135                 |
| Status | TS ✅ fixed · JS ⬜ · UMA ⬜ |

## Business Rule

At the hole stage, all hole cards for **all hands** must be face-up and visible to the player.
Community cards (flop/turn/river) are dealt face-down and revealed progressively as each betting
stage is reached.

## JavaScript Reference

**JS Source:** `hedgeem-v4/odobo/src/js/control.js`

The JS state machine deals all 13 cards (2 per hand × up to 4 hands + 5 community) via a sequence
of `CC_DEAL_CARDx` states, all of which are `CC_AUTO_ADVANCE`. Each call to `DealCard()` reveals
the card immediately. All hole cards are face-up before the first betting window (`CC_ALLOW_BETS_1`)
is reached.

```javascript theme={null}
// control.js — CC_DEAL_CARD1 … CC_DEAL_CARD13 (auto-advance, no player input)
// DealCard() renders each card face-up as it is dealt.
// After CC_DEAL_CARD13 → CC_ALLOW_BETS_1 (hole betting window opens).
```

Community cards are initially rendered face-down and flipped when their stage is reached.

## TypeScript Implementation

**File:** `standalone_reference_client/src/scenes/GameScene.ts`

### Bug fixed (HEDGE-135)

The original face-up logic was:

```typescript theme={null}
const faceUp = hand === 0 || dealStatus >= 1;
```

This only revealed hole cards for hand 0. Hands 1, 2, and 3 were face-down at hole stage.

**Fix applied:**

```typescript theme={null}
// All hole cards face-up once dealt — JS CC_DEAL_CARDx reveals all hands before CC_ALLOW_BETS_1.
// HEDGE-135.
const faceUp = true;
```

Community cards (`hand === -1`) are handled separately: face-up when `dealStatus >=` the stage
that reveals them (flop=1, turn=2, river=3).

## Acceptance Criteria

| #   | Criterion                                                     | JS | TS | UMA |
| --- | ------------------------------------------------------------- | -- | -- | --- |
| AC1 | All hole cards face-up at hole stage for all hands            | ⬜  | ✅  | ⬜   |
| AC2 | Community cards face-down at hole stage                       | ⬜  | ✅  | ⬜   |
| AC3 | Flop cards revealed when flop stage reached                   | ⬜  | ✅  | ⬜   |
| AC4 | Turn card revealed when turn stage reached                    | ⬜  | ✅  | ⬜   |
| AC5 | River card revealed when river stage reached                  | ⬜  | ✅  | ⬜   |
| AC6 | `cardData.length === 13` at page load (no player interaction) | ⬜  | ✅  | ⬜   |

## Version Parity

| Version        | Status        | Notes                                              |
| -------------- | ------------- | -------------------------------------------------- |
| JS (reference) | ⬜ Not audited | Auto-reveals via CC\_DEAL\_CARDx — assumed correct |
| TS             | ✅ Fixed       | HEDGE-135 — was only revealing hand 0              |
| UMA            | ⬜ Not audited | Phase 5                                            |

## Test Coverage

| Test                                 | Location                                              |
| ------------------------------------ | ----------------------------------------------------- |
| All hole cards face-up at hole stage | `tests/features/F022-card-display.spec.ts`            |
| Smoke — game renders at hole stage   | `standalone_reference_client/tests/e2e/smoke.spec.ts` |
