/// <summary> /// /// </summary> /// <param name="includeJokers"></param> public Cards(Boolean includeJokers) : base() { m_IncludeJokers = includeJokers; if (includeJokers) { this.Add(new Card(CardRankEnum.Joker1, CardSuitEnum.Jokers)); this.Add(new Card(CardRankEnum.Joker2, CardSuitEnum.Jokers)); } for (CardSuitEnum suit = CardSuitEnum.Hearts; suit < CardSuitEnum.Jokers; suit++) { for (CardRankEnum rank = CardRankEnum.Ace; rank < CardRankEnum.Joker1; rank++) { Card newCard = new Card(rank, suit); this.Add(newCard); } } }
/// <summary> /// /// </summary> /// <param name="rank"></param> /// <returns></returns> public List <Card> GetAllByRank(CardRankEnum rank) { List <Card> retVal = this.FindAll(x => x.Rank == rank); if (retVal != null) { retVal.Sort((x, y) => { return(x.Suit.CompareTo(y.Suit)); }); } if (retVal == null) { retVal = new List <Card>(); } return(retVal); }
public Card(CardRankEnum rank, CardSuitEnum suit) { m_Rank = rank; m_Suit = suit; }
/// <summary> /// /// </summary> /// <param name="suit"></param> /// <param name="rank"></param> /// <returns></returns> public Card GetBySuitAndRank(CardSuitEnum suit, CardRankEnum rank) { Card retVal = this.Find(x => x.Rank == rank && x.Suit == suit); return(retVal); }
public Card(string input) { Suit = InitSuit(input[input.Length - 1]); Rank = InitRank(input.Remove(input.Length - 1)); }