← 返回 scale.ai 的题目列表UNO-like Card Game Implementation
类型:online_judge
scale.ai
Implement a simple card game similar to UNO. Assume there are 4 players, each starting with X cards. The game uses a standard deck of 52 cards, but plays like UNO. The game starts by drawing a random card from the deck. Each player then plays a card that matches the current card's Rank or Suit in order. The rank and suit of the played card are scored. Players without a matching card draw from the deck. The game ends when a player has played all their cards, the player with the highest score wins.
Input: Initial card distribution and player action sequence.
Output: The final winning player and score statistics.
Test cases:
Initial deal: [Player1: ['5H', '7D'], Player2: ['2S', '9C'], Player3: ['KH', '3D'], Player4: ['QH', 'AS']]
Initial deal: [Player1: ['2H', '5D', '9S'], Player2: ['QS', '6C', 'JC'], Player3: ['KH', '2D', '4S'], Player4: ['5H', 'AS', '3D']]
Example
Input
Initial deal: [Player1: ['5H', '7D'], Player2: ['2S', '9C'], Player3: ['KH', '3D'], Player4: ['QH', 'AS']]