FastPrepFour-Player Trick-Taking Card Game Simulation
Problems/Four-Player Trick-Taking Card Game Simulation

Four-Player Trick-Taking Card Game Simulation

Scale AI logoScale AI● HardFULLTIMENEW GRADINTERNOAPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The task says to follow suit when possible, and otherwise play any card. The highest card of the lead suit wins the trick and leads next. Fish points are 5 for a five, 10 for a ten, and 10 for a king. It also asks for the played cards, the trick winners, the round scores and the final scores as output. We chose these rules. The deck order is supplied, cards are dealt round-robin, and player 0 goes first. We also fixed the suit and rank order, the choice of the first legal card, and the return of the final summary when all players tie. The first phase does not show in the newly captured task images. Our version is about 85% the same as the reported question.

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:

  1. Deal cards from left to right in round-robin order to players 0, 1, 2, 3. Each player receives 13 cards.
  2. Sort every hand by suit first and rank second, using the orders above.
  3. 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.
  4. The highest-ranked card of the leading suit wins the trick. That player leads the next trick.
  5. 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.

Output context

The full 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. Here the judged return value is the final score summary and all tied winners above. Be ready to extend the simulation with the 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.

More Scale AI Phone Screen questions

  • Task Processor: Dependencies and DeadlinesPHONE SCREEN · Seen Aug 2026
  • Best Poker Category with a JokerPHONE SCREEN · ONSITE INTERVIEW · Seen Jun 2026
  • Free Time for Every Meeting RoomPHONE SCREEN · Seen Apr 2026
  • Free Windows Between Busy IntervalsOA · PHONE SCREEN · Seen Apr 2026
  • Order Queries by Shortest Processing TimePHONE SCREEN · Seen Apr 2026
  • Party Time by Town and Quiet Gaps by CityPHONE SCREEN · Seen Jan 2026
  • Party Windows and Dead Zone TimePHONE SCREEN · Seen Oct 2025
  • Overlap Duration of Two Time IntervalsPHONE SCREEN · Seen Jun 2025
  • Multi-Head Attention BlockPHONE SCREEN · Seen Mar 2025
  • Top-K SamplerPHONE SCREEN · Seen Mar 2025

Similar questions at other companies

  • Parcel Attribute Store with TTLAirbnb · OAAirbnb interview questions
  • Popular and Instant-Runoff Election WinnersCoursera · PHONE SCREEN
  • Meeting Rooms IIIBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Macaron Order with Set DiscountsShopify · OAShopify interview questions
  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Capping Portfolio WeightsCapstone Investment Advisors · OA
  • Determine the Winner of Three-Card HandsOpenAI · PHONE SCREENOpenAI interview questions
  • Pins Violation Log QueriesPinterest · PHONE SCREENPinterest interview questions
  • Resource Reconciler: Plan and Apply CreatesPerplexity AI · PHONE SCREENPerplexity AI interview questions
  • Shortest-Job-First Process SchedulingByteDance · PHONE SCREENByteDance interview questions

Interview reports that mention this question

  • Scale AI OA: What It Tests (2026)
  • Scale AI New Grad SWE and MLE Question Bank
  • Scale AI New Grad SWE Card Game Phone Screen: 1 Experience
  • Scale AI New Grad SWE Card Game Interview: 1 Experience
  • Scale AI New Grad SWE Card Game Screen: 1 Experience
  • Scale AI New Grad SWE Card Game Interview: 1 Experience
All Scale AI interview questionsSee Scale AI hiring insights
Saved
class Solution {
    public String simulateTrickTakingGame(String deckOrder) {
        // Write your solution here
    }
}

Not a valid String

Checking account…