Editorial illustration: Debugging Hokm through state snapshots

Debugging Hokm through state snapshots

The problem I needed to solve

When a Hokm bug appears only near a hand’s end, replaying every stage is a slow way to investigate it. I needed observation and controlled state construction.

Implementation in this snapshot

HokmDebugQaTools.BuildSnapshot gathers players, hand, trick and match state. ForceHakemForNewHand, ForceTrump and SetTrickScoreForDebug can construct a targeted scenario.

The design decision and its cost

Snapshot construction is separate from final presentation, and FormatSnapshot produces readable text. Score editing checks numeric limits to avoid completely meaningless debug input.

Current boundaries

Debug tools are not product certification. The presence of runtime testers or a documentation report does not mean I ran them successfully against this export; that requires Unity and the complete scene.

Constructing a near-ending state for investigation

Suppose an issue appears only at six tricks each. SetTrickScoreForDebug can reset hand state, set trump and increment team counts through AddTrickPoint. This replaces playing every card for a targeted investigation, but does not generate the actual earlier trick history. The constructed state suits a bounded question, such as how hand completion behaves at those counts. It should not be presented as evidence from a naturally played match with every preceding event.

BuildSnapshot collects hands, controller types, Hakem, dealer, active seat, leader, suits and both scoring cycles. It skips assignments without players and substitutes defaults such as Seat0 or zero for some missing states. That permits incomplete reports, but readers must distinguish defaults from verified state. Zero does not necessarily mean a match genuinely started at zero. FormatSnapshot labels trick and match scores separately in its readable report.

Mutation tools reject negative scores and values above the configured target. Those bounds do not prove consistency among card counts, current trick and animation flow. ForceTrump and ForceHakemForNewHand convert state-operation exceptions into Failure results for explicit feedback. This study describes code and documentation capabilities; successful runtime testers or complete QA require Unity and the full scene. Debug-tool availability is not a report of executed tests.

What this stage taught me

These tools let me ask precise questions about actual state. For me, that means less guessing: identify which stage and data are wrong before investigating appearance or rules.

Explore Dalo

Latest devlogs

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
Editorial illustration: Capturing table cards in Pasur

Capturing table cards in Pasur

In my teammate’s implementation, Pasur combines selecting a hand card with selecting table cards. Its rules must produce valid sets and prohibit ignoring an available capture.

Read article
Editorial illustration: A real choice between Joker’s final two players

A real choice between Joker’s final two players

With two players holding two and one cards, some turns force a draw without a choice. I made that case an explicit count-based rule.

Read article
Dalo