求解一个有关字符串的发牌问题
求解把52张牌发给四个人,判断其中一个人的牌中是否有:一对,两对,三张同点的牌、五张点数连续的牌、三张同点加一对的牌,并输出,,,哪位高手给个代码,万分感谢
[解决办法]
个人觉得
final String faces[] = {"Ace","Deuce","Three","Four","Five","Six","Seven",
"Eight","Nine","Ten","Jack","Queen","King"};
final String suits[] = {"Hearts","Diamonds","Clubs","Spades"};
这样定义不是太好,因为判断重复的时候很麻烦。
所以建议,例如:
final String[] heartsFaces = {"H.A","H.2","H.3","H.4"......"H.J","H.Q","H.K"};
其他花色的也同样。
每次发牌都随机从数组中移除,这样避免出现重复的牌。