A fair shuffle.
A private hand.
Here is the algorithm the game actually uses. Open the complete engine source to inspect it.
1. Make the deck
Start with 32 unique cards: spades, hearts, diamonds and clubs, each ranked 7 through ace. Aces have rank 14. There are no jokers. With four players, the 8-card hand that starts each set deals the whole deck.
2. Shuffle every hand
Use the Fisher–Yates shuffle: starting at the last card, choose a uniformly random position from the first card through the current card, swap those two cards, and move one position left. Repeat until the deck is shuffled.
for (let i = deck.length - 1; i > 0; i--) {
const j = randomInt(i + 1); // 0 through i, inclusive
[deck[i], deck[j]] = [deck[j], deck[i]];
}
On the Node server, randomInt uses Node’s cryptographic random generator. Browser practice and the hosted Worker use crypto.getRandomValues with rejection sampling: values outside the largest evenly divisible range are discarded before taking the remainder. This avoids modulo bias. Game randomness never uses Math.random.
With independent uniform random draws, Fisher–Yates gives every deck ordering the same probability. Each hand starts with a freshly shuffled full deck. There is no player weighting, catch-up mechanic or adjustment based on anyone’s score.
3. Deal one card at a time
Starting with the player clockwise after the dealer, give each player one card from the shuffled deck. Continue clockwise until everyone has the required number. Each dealt card is removed from the deck. Sorting a hand afterward is only for readability.
for (let n = 0; n < cardsPerPlayer; n++) {
for (let offset = 1; offset <= 4; offset++) {
players[(dealer + offset) % 4].hand.push(deck.pop());
}
}
4. Determine trump
The first hand of each set deals every card, so hearts are trump. In every later hand, turn over the top undealt card. Its suit is trump. It does not belong to a player. Highest trump wins a trick; otherwise the highest card in the suit led wins. Follow the led suit when you can.
trump = firstHandOfSet || deck.length === 0
? hearts
: deck.pop(); // turned-up card
5. Keep hands private
In family multiplayer, the server deals and checks every move. Each browser receives its own hand, other players’ card counts, bids, played cards and scores. Opponents’ unplayed cards are omitted from its response. Practice runs locally with computer players and is not intended as a secrecy boundary.
Publishing the algorithm does not publish the deck order, random draws or seat credentials. This is inspectable shuffle logic, not a cryptographic proof that the server behaved honestly: no public seed or commit-and-reveal protocol is implemented.