Reported August 2026
Scale AIsimulation

Four-Player Trick-Taking Card Game Simulation

Reported by candidates from Scale AI's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Scale AI OA. Under 2s to a working solution.
Founder's read

The Scale AI OA reported in August 2026 isn't about clever algorithms. It's a trick-taking card game simulation, and the only way to lose is to misread one rule. Deal 52 cards round-robin, sort each hand, play 13 tricks, tally points for 5, T and K, and print every tied winner. There's no input size to fear, since the deck is always exactly 52 cards, so brute force is fine and nobody is asking you to optimize. If you blank on the structure under pressure, StealthCoder is the invisible backup that reads the problem and hands you a clean solution.

The problem

Simulate a four-player trick-taking card game from a supplied shuffled deck order.
deckOrder contains all 52 card codes separated by one space. A card code is its rank followed by its suit. Ranks are 2 3 4 5 6 7 8 9 T J Q K A, from lowest to highest. Suits are C D H S, from lowest to highest.
Model the game with cards, a deck, and four players, then apply these rules:
Deal cards from left to right in round-robin order to players 0, 1, 2, 3. Each player receives 13 cards.
Sort every hand by suit first and rank second, using the orders above.
Player 0 leads the first trick. For each turn, a player plays the first card in their sorted remaining hand that follows the leading suit. If they cannot follow suit, they play the first card in their remaining hand.
The highest-ranked card of the leading suit wins the trick. That player leads the next trick.
Cards of rank 5, T, and K are worth 5, 10, and 10 points respectively; every other card is worth 0. The trick winner receives all points in that trick.
After 13 tricks, return scores=[s0,s1,s2,s3];winners=[w0,w1,...]. List every player tied for the highest score in ascending player order.
Interview Output Context
The reported exercise also asks to show each player and played card, every trick winner, and the points awarded in every trick before showing game totals and a highest-scoring player. For this practice adapter, the judged return value is the final score summary and all tied winners above. Be ready to extend the simulation with the original per-turn and per-trick trace; the played cards, trick winner, and trick points are already computed during each round.

Function
simulateTrickTakingGame(deckOrder: String) → String

Examples
Example 1
deckOrder = "2C 2D 2H 2S 3C 3D 3H 3S 4C 4D 4H 4S 5C 5D 5H 5S 6C 6D 6H 6S 7C 7D 7H 7S 8C 8D 8H 8S 9C 9D 9H 9S TC TD TH TS JC JD JH JS QC QD QH QS KC KD KH KS AC AD AH AS"
return = "scores=[100,0,0,0];winners=[0]"
Round-robin dealing gives player 0 every club. The other players cannot follow clubs, so player 0 wins every trick and receives all 100 fish points.
Example 2
deckOrder = "2C 3C 4C 5C 6C 7C 8C 9C TC JC QC KC AC 2D 3D 4D 5D 6D 7D 8D 9D TD JD QD KD AD 2H 3H 4H 5H 6H 7H 8H 9H TH JH QH KH AH 2S 3S 4S 5S 6S 7S 8S 9S TS JS QS KS AS"
return = "scores=[5,15,15,65];winners=[3]"
The deterministic first-legal-card policy produces scores 5, 15, 15, 65. Player 3 has the highest score.
Example 3
deckOrder = "JS KH AD 8C 7H 3S TS JC TD 2C 8S 4S 7C QH JH 3D 7S 3C 9C 6H 4C 5D AH 6C QD 8D JD KD 6D 4D 5C QC 5H TC 4H 3H 9H 5S KC TH 9S 8H QS AS 2S 2H KS 7D 6S 9D 2D AC"
return = "scores=[20,0,40,40];winners=[2,3]"
Players 2 and 3 each receive 40 points. Both appear in the ascending winner list.

Constraints
deckOrder contains exactly 52 card codes separated by single spaces.
Every combination of one rank from 23456789TJQKA and one suit from CDHS appears exactly once.
The total score across all four players is always 100.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The pattern is pure simulation. Parse the deck, deal card i to player i % 4, then sort each hand by (suit index, rank index) using the given orders. For each trick, start at the leader and go around four players clockwise. Each player plays the first card in their sorted hand matching the lead suit, otherwise their first card. Remove it from the hand. The winner is the highest-ranked card of the lead suit only, so off-suit discards never win. Add 5, 10 or 10 points for 5, T, K to the winner and make them the next leader. The classic pitfalls are sorting by rank first, letting an off-suit card win, forgetting the turn order wraps from the leader, and returning only one winner on a tie. Format output exactly as scores=[...];winners=[...]. If the live OA rattles you, StealthCoder is the hedge that covers the details.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Four-Player Trick-Taking Card Game Simulation cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Scale AI's OA.

Scale AI reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Four-Player Trick-Taking Card Game Simulation FAQ

How hard is the Scale AI card game simulation really?+

Easy on algorithms, medium on care. There's no data structure trick, just 52 cards and 13 tricks. Most failures come from misreading one rule, like sort order, who leads, or which card wins. Write it slowly and test against the three examples.

What's the trick to this problem?+

There isn't one beyond modeling cleanly. Keep a rank index map and a suit index map, sort hands by (suit, rank), and track a leader variable. Play order is leader, leader+1, and so on modulo 4. Only cards of the lead suit can win.

How should I handle ties in the final output?+

Compute the max score, then collect every player whose score equals it, in ascending player order. Example 3 expects winners=[2,3]. Format it as a comma-separated list with no spaces inside the brackets, matching the examples exactly.

Do I need to produce the per-trick trace?+

The judged return is only the score summary and winners. But the problem says to be ready to extend it, so record played cards, trick winner and points in each round as you compute them. It costs almost nothing and helps if a follow-up asks.

How do I prepare for this in 48 hours?+

Practice writing simulations with custom sort keys and a rotating index. Run Example 1 by hand first, since the answer is easy to verify at 100 points for player 0. Then check Example 2. If both pass, your rules are probably right.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Scale AI.

OA at Scale AI?
Invisible during screen share
Get it