3
我正在寫一個小型的紙牌遊戲,其中兩名玩家手中各有4張紙牌,他們必須在桌上採取儘可能多的紙牌。它使用經典的撲克牌,所以種子和價值相同。獨特組合的紙牌遊戲算法
King can only take another King
Queen can only take another Queen
Jack can only take another Jack
編號卡可以通過總和取,因此,例如:
10H takes 6C + 4S
5S takes 3C + 2D or 3S + 2D
7S takes 4S + 3S or 5C + 2D
And so on...
種子是不相關的...只有值。但問題是我需要計算獨特的組合。因此,舉例來說,我只希望這些連擊的一個種子和值是相同的:
10H -> 6C + 4S
10H -> 4S + 6C
是否有任何預製功能做到這一點?我試着用谷歌和維基百科四處尋找,但可能我不知道英文中的算法/問題的名稱。唉...我忘記了......解決方案可以是任何你想要的(簡單,遞歸,linq)。
看起來像是,但沒有maxCount限制。 –