public virtual bool Check() { if (!NumberLimitRule.Check(NumberLimit, Pokers.Count)) { return(false); } if (!Pokers.All(x => x.Display == Pokers.First().Display)) { return(false); } return(true); }
public bool Check() { if (!NumberLimitRule.Check(NumberLimit, Pokers.Count)) { return(false); } var pokerKeys = Pokers.Select(x => x.Display).Distinct(); if (pokerKeys.Count() != 2) { return(false); } return(Pokers.Count(x => x.Display == pokerKeys.First()) == 3 || Pokers.Count(x => x.Display == pokerKeys.Last()) == 3); }
public bool Check() { if (!NumberLimitRule.Check(NumberLimit, Pokers.Count)) { return(false); } //不能包含大小王和2 //不能有相同 for (var i = 1; i < Pokers.Count; i++) { if (Pokers[i].Weight == Pokers.First().Weight) { return(false); } } //连续的,这里是最大的减去最小的等于一个值 return(Pokers.Max(x => x.Weight) - Pokers.Min(x => x.Weight) == Pokers.Count - 1); }
public bool Check() { if (!NumberLimitRule.Check(NumberLimit, Pokers.Count)) { return(false); } //判断数目是否是偶数 if (Pokers.Count % 2 != 0) { return(false); } //不能包含大小王和2 if (!Pokers.Select(x => x.Display).Distinct().All(x => Pokers.Count(y => y.Display == x) == 2)) { return(false); } //判断牌是否是连续的,这里是最大的减去最小的等于一个值 return(Pokers.Max(x => x.Weight) - Pokers.Min(x => x.Weight) == Pokers.Count - 1); }