Skip to content

seatView

seatView<T, H>(perSeat, viewer, hidden): (T | H)[]

Defined in: cards/visibility.ts:43

Shows a viewer the values for the seats they hold and a hidden form of every other seat's value. perSeat is indexed by seat; viewer is the Viewer passed to view() (spectators hold no seats, so they see only hidden forms).

view: ({ state, viewer }) => ({
...state,
hands: seatView(state.hands, viewer, faceDown), // own hand, others as nulls
bets: state.bets, // public, left as is
deck: state.deck.length, // never send the deck itself
}),

hidden also receives the seat, for example to reveal hands at showdown: seatView(state.hands, viewer, (hand, seat) => revealTo(hand, state.shown[seat])).

T

H

readonly T[]

readonly number[]

(value, seat) => H

(T | H)[]