Esempio n. 1
0
        static IEnumerable<PokerHand> ExtractPokerHands()
        {
            var input = Properties.Resources.problem54_poker;
            var lines = input.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);

            int id = 0;

            foreach (var l in lines)
            {
                var parts = l.Split(' ');
                var cards1 = parts.Take(5).Select(c => new Card(c.Substring(1, 1), c.Substring(0, 1)));
                var cards2 = parts.Skip(5).Take(5).Select(c => new Card(c.Substring(1, 1), c.Substring(0, 1)));

                var p1 = new PlayerHand(cards1.ToArray());
                var p2 = new PlayerHand(cards2.ToArray());

                yield return new PokerHand(++id, p1, p2);
            }
        }
Esempio n. 2
0
 public PokerHand(int id, PlayerHand player1, PlayerHand player2)
 {
     _id = id;
     _p1 = player1;
     _p2 = player2;
 }