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