public void CardUtil_GetFace() { Assert.AreEqual(CardType.QUEEN, CardUtil.GetFace(SheepCard.QUEEN_CLUBS)); Assert.AreEqual(CardType.QUEEN, CardUtil.GetFace(SheepCard.QUEEN_DIAMONDS)); Assert.AreEqual(CardType.N7, CardUtil.GetFace(SheepCard.N7_CLUBS)); Assert.AreEqual(CardType.N7, CardUtil.GetFace(SheepCard.N7_DIAMONDS)); }
public override bool GoItAlone(IHand hand) { var trumpCount = Cards.Count(c => CardUtil.GetSuit(c) == Suit.TRUMP); var queenJackCount = Cards.Count(c => new[] { CardType.JACK, CardType.QUEEN }.Contains(CardUtil.GetFace(c))); var queenCount = Cards.Count(c => CardUtil.GetFace(c) == CardType.QUEEN); return(trumpCount >= 5 && queenJackCount >= 3 && queenCount >= 2); }
public BuriedCardSelector(IReadOnlyList <SheepCard> cards) { CardsPerSuit = cards .Where(c => CardUtil.GetSuit(c) != Suit.TRUMP) .GroupBy(c => CardUtil.GetSuit(c)) .ToDictionary(g => g.Key, g => g.Count()); _cards = cards; _acesAndTens = cards .Where(c => CardUtil.GetSuit(c) != Suit.TRUMP) .Where(c => new[] { CardType.ACE, CardType.N10 }.Contains(CardUtil.GetFace(c))) .ToList(); _acesAndTensPerSuit = _acesAndTens .GroupBy(c => CardUtil.GetSuit(c)) .Where(g => g.Key != Suit.TRUMP) .OrderBy(g => g.Count()) .ToList(); }
private int CountQueensJacks(IPlayer thisPlayer) { return(thisPlayer.Cards.Count(c => new[] { CardType.JACK, CardType.QUEEN }.Contains(CardUtil.GetFace(c)))); }