feat(SCOPONE-0005): iteration 5 — sort hand by value then suit

This commit is contained in:
Giancarmine Salucci
2026-03-31 23:05:00 +02:00
parent c3a79b028b
commit d80d4df6bd

View File

@@ -11,7 +11,7 @@ import { CardTracker } from '../game/card-tracker';
// ---------------------------------------------------------------------------
const SUIT_ORDER: Record<string, number> = { denara: 0, coppe: 1, bastoni: 2, spade: 3 };
function sortHand(hand: Card[]): void {
hand.sort((a, b) => (SUIT_ORDER[a.suit] - SUIT_ORDER[b.suit]) || (a.value - b.value));
hand.sort((a, b) => (a.value - b.value) || (SUIT_ORDER[a.suit] - SUIT_ORDER[b.suit]));
}
// ---------------------------------------------------------------------------