Exemplo 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]);
 }
Exemplo 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
     }));
 }
Exemplo 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();
        }
Exemplo n.º 4
0
 public IReadOnlyList <Stats> ComputeStats(Table table)
 {
     VerifyArg.NotNull(table, nameof(table));
     return(ComputeStatsInternal(
                table.Pockets.Select(ToIndex).ToArray(), ToIndex(table.Community)));
 }
Exemplo n.º 5
0
 public ObjectPool(Func <TKey, TObject> factory)
 {
     VerifyArg.NotNull(factory, nameof(factory));
     mObjects = new Dictionary <TKey, TObject>( );
     mFactory = factory;
 }