Editorial illustration: Four seats and two teams in Hokm

Four seats and two teams in Hokm

The problem I needed to solve

Four cards on screen are not enough to implement Hokm correctly. I need to know each seat’s team, partner and successor without tying rules to visual coordinates.

Implementation in this snapshot

HokmSeatResolver.GetTeam reads HokmGameConfig. GetPartnerSeat finds the other teammate, while ArePartners does not classify a seat as its own partner.

The design decision and its cost

BuildTurnOrderFrom creates an order beginning at a seat and wraps indices. I kept Hokm’s direction contract explicit; it should not be guessed from index signs in TurnManager.

Current boundaries

An incomplete configuration can have no partner, causing an error. This class does not inspect avatar positions or UI coordinates, so incorrect visual wiring remains a separate concern.

Logical table direction and visual rearrangement

If a mobile table rotates to keep the human player at the bottom, partnership must survive avatar rearrangement. GetTeam reads HokmGameConfig, and GetPartnerSeat searches that configuration for a different seat with the same TeamId. Visual left and right are therefore not scoring authorities. This also matters for bots: supporting a partner must depend on seat identity, not on which card appears closest or opposite in the Canvas.

Here, GetNextSeat increments the seat index for CounterClockwise and decrements it for Clockwise. That contract should not be guessed from the generic turn manager’s direction sign. FromSeatIndex wraps across four seats and corrects negative indices. BuildTurnOrderFrom produces four entries along that path, beginning with its argument. Passing that explicit list to dealing or Hakem selection helps their ordering follow a single definition.

ArePartners requires distinct seats, whereas GetTeam only answers team membership. A seat shares its own TeamId but is not its own partner in gameplay terms. That distinction can prevent a bot from incorrectly treating itself as a partner to support. The resolver validates seat-ID range, though it does not repair incomplete configuration or incorrect visual wiring. Missing partner data raises an error and should lead to correcting the configuration rather than inventing a partner.

What this stage taught me

When bots or scoring ask about teams, one central answer is preferable. This boundary separates the meaning of partnership from the table’s apparent left and right.

Explore Dalo

Latest devlogs

Editorial illustration: Pasur launch and telemetry in the shared structure

Pasur launch and telemetry in the shared structure

Adding Pasur needs both a correct mode handoff and valid public telemetry.

Read article
Editorial illustration: Presenting selection and captures in Pasur

Presenting selection and captures in Pasur

Pasur motion should explain which hand card was played and which table cards were captured.

Read article
Editorial illustration: Pasur bot decisions from capture options

Pasur bot decisions from capture options

My teammate’s Pasur bot chooses among legal options without inspecting hidden opposing cards.

Read article
Dalo