计算列表中某些子集具有不同值的最小和

2024-04-24 13:20:37 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用python重新创建纸牌游戏“五皇冠”,我遇到了一个棘手的算法问题,我无法计算出一手牌的得分。基本上,评分是这样的:

As in the game Three Thirteen, players create sets or runs of 3 or more, using the Jokers and the current round's wild card as wilds. Each round has a different wild card (the 3's in the 3-card hand, 4's in the 4-card hand, 5's in the 5-card hand, and so on until the King is wild in the 13-card hand).

更多信息->;https://en.wikipedia.org/wiki/Five_Crowns_(game)

每套3张或3张以上的牌值0分,每套3张或3张以上的牌值0分,你的得分是手中牌值的总和。(Ace(1)至国王(13)和未使用的小丑(50))

e.g. with a hand of [1, 3, 4, 6, 7, 11]

 - The wild card is 6
 - Score would be 18
    - Run of 1, 6, 3, 4 = 0 
    - 7
    - 11
e.g. with a hand of [2, 2, 8, 11, 12, 13, 50, 50]

 - The wild card is 8
 - Score would be 0
   - Run of 8, 11, 12, 13 = 0 
   - Set of 2, 2, 50, 50 = 0

我不知道如何解决这个问题。有没有类似的算法?你知道吗

感谢所有建议!你知道吗


Tags: orandofthein算法gameis