Beispiel #1
0
            static ScorableHand?StraightPattern(Hand h)
            {
                var high               = RankValue(h);
                var lowHypothetical    = high - 4;
                var lowStraightRanking = new [] { Ace, 5, 4, 3, 2 };
                var typicalRanking     = Enumerable.Range(lowHypothetical, 5).Reverse();

                return(h switch {
                    Hand hl when lowStraightRanking.SequenceEqual(Ranking(hl)) =>
                    ScorableHand.NewEntireHand(hl.Select(c => c.Rank == Ace ? new (1, c.Suit): c)),
                    Hand hx when typicalRanking.SequenceEqual(Ranking(hx)) =>
                    ScorableHand.NewEntireHand(hx),
                    _ => null
                });
Beispiel #2
0
 static ScorableHand?FlushPattern(Hand h) =>
 IsFlush(h)
         ? ScorableHand.NewEntireHand(h)
         : null;