Chinese Hearts, also known as Gong Zhu (拱猪, Chase the Pig), is a variance of the Hearts game. It is a 4 player card game with the aim to earn the highest amount of points. You may read more about it on Wikipedia. This time, we want implement a program (full or function) to calculate ones score.
Scoring
The player who plays the highest-value card of the suit that is led wins all cards in this round. And after the game, the score is calculated by these cards:
- ♥2, ♥3, ♥4 = 0 points for each;
- ♥5, ♥6, ♥7, ♥8, ♥9, ♥10 = -10 points for each;
- ♥J = -20 points;
- ♥Q = -30 points;
- ♥K = -40 points;
- ♥A = -50 points;
- ♠Q = -100 points; ♠Q known as the Pig (猪)
- ♦J = +100 points; ♦J known as the Goat / Sheep (羊)
- ♣10 = +50 points along, and x2 with other cards; ♣10 known as the Double / Transformer (变压器)
Special rules:
- If a player collects only ♣10, it is worth +50 points. But if a player collects ♣10 together with any other non-zero point cards, it doubles the other cards' points.
- If a player collects all hearts ♥2 ~ ♥A (全红), ♥2 ~ ♥A count as +200 points instead of -200 points.
- If a player collects all hearts plus ♠Q and ♦J, ♠Q counts as +100 points instead of -100 points.
Scoring rules may vary from place to place. Note that this challenge does not include "sell" (卖/明牌) which would make it more complex.
Input / Output
Input would be a string (or a list of characters).
23456789TJQKA
for♥2
~♥A
P
for♠Q
G
for♦J
D
for♣10
All other cards are ignored from input. You won't get characters out of this list. We use one deck of cards (52 cards) in this challenge. So, there won't be duplicate cards in the input.
Output as an integer, the score of these cards.
Examples and Testcases
Input Output
234 0
56789T -60
T -10
J -20
Q -30
K -40
A -50
TJQK -100
P -100
G 100
TJQKP -200
PG 0
2468TQKG 0
D 50
234D 50
GD 200
PGD 0
TJQKGD 0
23456789TJQK -150
3456789TJQKA -200
23456789TJQKA 200
23456789TJQKAP 100
23456789TJQKAG 300
23456789TJQKAPG 400
2356789TJQKAPD -600
23456789TJQKAPGD 800
DP2A45968TJK7QG3 800
DP24 -200
G2P6D4 -20
Rule
- This is code-golf, shortest codes in bytes win.
- Standard loopholes are forbidden.
Note: Some details of scoring rules may be differ from game to game. Some rules allow all hearts plus ♠Q count as +300 points, regardless whether ♦J is collected or not. Some rules apply ♥2, ♥3, ♥4 to ♣10, and collecting ♥2, ♥3, ♥4 together with ♣10 is 0 points instead of +50 points. However, your answer have to follow the rule described in this post.