Esempio n. 1
0
 public static int GetScore(IReadOnlyList <Card> hand)
 {
     VerifyArg.NoneNull(hand, nameof(hand));
     VerifyArg.Count(hand, nameof(hand), 5);
     return(Table[hand[0].Index][hand[1].Index][hand[2].Index][hand[3].Index]
            [hand[4].Index]);
 }
Esempio n. 2
0
 public static Pocket Create(Card card1, Card card2)
 {
     VerifyArg.NotNull(card1, nameof(card1));
     VerifyArg.NotNull(card2, nameof(card2));
     return(new Pocket(new List <Card>()
     {
         card1, card2
     }));
 }
Esempio n. 3
0
        public Table(IEnumerable <Pocket> pockets, IEnumerable <Card> community)
        {
            VerifyArg.NoneNull(pockets, nameof(pockets));
            VerifyArg.Nonempty(pockets, nameof(pockets));
            Pockets = pockets.ToList().AsReadOnly();

            VerifyArg.NoneNull(community, nameof(community));
            VerifyArg.True(community.Count() <= 5,
                           nameof(community), "Collection must not contain more than 5 items.");
            Community = community.ToList().AsReadOnly();
        }
Esempio n. 4
0
 public IReadOnlyList <Stats> ComputeStats(Table table)
 {
     VerifyArg.NotNull(table, nameof(table));
     return(ComputeStatsInternal(
                table.Pockets.Select(ToIndex).ToArray(), ToIndex(table.Community)));
 }
Esempio n. 5
0
 public ObjectPool(Func <TKey, TObject> factory)
 {
     VerifyArg.NotNull(factory, nameof(factory));
     mObjects = new Dictionary <TKey, TObject>( );
     mFactory = factory;
 }