1
0
Fork 0
polaris-task-force/src/lib/minigames/poker/handRankStyle.ts
Z8MB1E 1b0e4ed074 feat(poker): grade hand ranks on a progressive style ladder
Every made hand maps to a presentation tier from high card (no styling) through brass, silver, and gold pairs to a sapphire straight flush and a royal flush prismatic treatment. The live hand hint carries the tier, so the you-have placard glows with your hand's rank, and royals now read as royal flush.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-09-11 17:30:03 -04:00

18 lines
661 B
TypeScript

import { HAND_CATEGORIES } from "./evaluator";
import type { HandRank } from "./types";
/**
* Presentation tier for a made hand: 0 (high card, no styling) through
* 9 (royal flush, full prismatic treatment). Each step up the ladder gets a
* more intense border and glow; see the poker-rank-tier-* rules in styles.css.
*/
export const ROYAL_RANK_TIER = 9;
export function handRankTier(hand: HandRank): number {
const royal = hand.category === HAND_CATEGORIES.STRAIGHT_FLUSH && hand.tiebreakers[0] === 14;
return royal ? ROYAL_RANK_TIER : hand.category;
}
export function handRankTierClass(tier: number): string {
return `poker-rank-tier-${tier}`;
}