Editorial illustration: A legal bot before a clever bot

A legal bot before a clever bot

The problem I needed to solve

Before more complicated tactics, I wanted an explainable baseline. A bot should play legally and at least distinguish its partner from an opponent.

Implementation in this snapshot

HokmBasicBotCardStrategy.ChooseCard gets legal cards from HokmLegalCardValidator. It leads with a low-cost card, conserves strength when its partner is winning, and seeks the lowest winning card against an opponent.

The design decision and its cost

When winning is impossible, it continues with a low-cost choice. HokmBotCardSelectionReason reports the reason, separating selection from rejected input.

Current boundaries

This strategy has no advanced memory or future search. The word bot does not establish human-level skill or any particular win rate; its value is a comprehensible baseline.

A low-cost choice with an explicit reason

For this baseline bot, the lowest-cost card is not necessarily the hand’s lowest rank. CompareCardForLowestPower first prefers non-trump over trump, then compares rank strength and finally suit order. That is an explicit trump-conservation policy. The bot uses ChooseLowestSafeCard when leading a trick. Safe in the method name does not guarantee winning; this baseline does not model opponents’ void-suit evidence or future threats.

When the partner currently leads, the bot proposes its low-cost choice. Against an opponent, ChooseLowestWinningCard examines legal cards and retains candidates accepted by CanCardBeatCurrentWinner. Trump beats non-trump, non-trump cannot beat an existing trump, and other comparisons depend on lead suit and rank strength. This evaluates the current winner of an incomplete trick, not the final winner after everyone plays. A later player may still beat the chosen card.

ChooseCard rejects missing inputs, invalid configuration, a complete trick or absent legal options. Successful results include HokmBotCardSelectionReason, distinguishing leading, partner support, beating an opponent and discarding. This makes policy changes traceable to decision branches. ChooseCard neither removes the card nor advances turns, though. Its recommendation must pass through a valid execution path; AI selection does not replace game-rule enforcement.

What this stage taught me

For me, this provided a comparison point. Later intelligence should improve identifiable decisions rather than redefine card legality from scratch.

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