feat(SCOPONE-0005): iteration 5 — sort hand by value then suit
This commit is contained in:
@@ -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]));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user