Skip to content

feat!(lua.endpoints): add sort endpoint for hand sorting by rank/suit #213

Description

@S1M0N38

Summary

Add a new sort endpoint that exposes the in-game "Sort Hand" buttons (Sort by Rank / Sort by Suit) from the play/discard bar in SELECTING_HAND.

Params

method: sort
params: { by: "rank" | "suit" }
returns: GameState
required state: SELECTING_HAND

Maps to the existing callbacks:

  • by: "rank"G.FUNCS.sort_hand_valueG.hand:sort('desc')
  • by: "suit"G.FUNCS.sort_hand_suitG.hand:sort('suit desc')

Why

The sort logic lives server-side in Card:get_nominal and reads card.base.* (ignores facing), so hidden cards land in their true sorted position among visible ones. This makes sorting a genuine deduction oracle for fair-play bots that intentionally hide face-down card values (e.g. from The Wheel, The House, The Mark, The Fish) and want to play as a human would — triangulating rank and suit by alternating rank/suit sorts and tracking cards across the reorder by their stable id.

This cannot be replicated with the existing rearrange endpoint, since rearrange requires the caller to already know the target permutation, which defeats the purpose when card values are hidden from the client.

Scope

Hand-only, SELECTING_HAND-only — matches the game's own button bar exactly.

Metadata

Metadata

Assignees

Labels

completed-in-devThis issue have been solved in dev branch

Fields

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions