Hearts is a trick-taking card game for 4 players. Each trick is taken by the player who played the highest card of the leading suit. At the end of each hand, the players incur a penalty score depending on the penalty cards they have taken; the task is to determine the scores under Microsoft Hearts rules.
Input
Input is 4 lists (or delimited string, array, etc.) showing the penalty cards taken by each of the 4 players. The penalty cards are
2♥, 3♥, 4♥, 5♥, 6♥, 7♥, 8♥, 9♥, 10♥, J♥, Q♥, K♥, A♥, Q♠
which we shall represent as
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 0
respectively.
Output
Output is the 4 penalty points incurred by the 4 players (list, string, array etc.). Scoring is as follows:
- Each heart (
♥
, represented by integers1
to13
inclusive) incurs 1 point - The queen of spades (
Q♠
, represented by0
) incurs 13 points - Exception: if a player has taken all of the penalty cards (called shooting the moon), then he incurs 0 points, while all other players incur 26 points.
Test cases
[2, 8, 7, 1], [3, 4], [], [9, 5, 6, 0, 10, 11, 12, 13] --> 4, 2, 0, 20
[0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [], [], [1] --> 25, 0, 0, 1
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0], [], [], [] --> 0, 26, 26, 26
Shortest code in bytes wins.