Sort cards C D S H so same-colour suits aren't adjacent
Reorder the suit sort (hand + widow overlay) to alternate colours (clubs, diamonds, spades, hearts) so hearts and diamonds no longer sit next to each other. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -351,7 +351,8 @@ function trumpRank(card) {
|
||||
}
|
||||
|
||||
// Suit display order: C D H S JOKER
|
||||
const SUIT_ORD = { C: 0, D: 1, H: 2, S: 3, JOKER: 4 };
|
||||
// Alternate colours (black-red-black-red) so same-colour suits aren't adjacent
|
||||
const SUIT_ORD = { C: 0, D: 1, S: 2, H: 3, JOKER: 4 };
|
||||
function sortCards(hand) {
|
||||
return [...hand].sort((a, b) => {
|
||||
const sa = SUIT_ORD[suitOf(a)], sb = SUIT_ORD[suitOf(b)];
|
||||
|
||||
Reference in New Issue
Block a user