private Player DetermineStartingPlayer() { var currentPlayer = game.Players[0]; foreach (var player in game.Players) { foreach (var card in player.Hand) { if (card.Symbol == "9" && card.Suit == GameView.Suit("clubs")) { currentPlayer = player; } } } return(currentPlayer); }
public static List <Card> CreateCardDeck() { var CardSymbols = new List <string> { "A", "K", "Q", "J", "10", "9" }; var CardSuits = new List <string> { GameView.Suit("spades"), GameView.Suit("hearts"), GameView.Suit("clubs"), GameView.Suit("diamonds") }; var DrawPile = new List <Card>(); foreach (var symbol in CardSymbols) { foreach (var suit in CardSuits) { var card = new Card(symbol, suit); DrawPile.Add(card); } } return(DrawPile); }
private static Card LowestCardNotHeart(Player player) { return(player.Hand.OrderBy(z => z.Rank).Where(z => z.Suit != GameView.Suit("hearts")).FirstOrDefault()); }
private static Card LowestCardSpade(Player player) { return(player.Hand.OrderBy(z => z.Rank).Where(z => z.Suit == GameView.Suit("spades")).FirstOrDefault()); }
private static bool AtLeastOneNotHeartInHand(Player player) { return(player.Hand.Where(z => z.Suit != GameView.Suit("hearts")).FirstOrDefault() != null); }
private static bool AtLeastOneHeartWasPlayed() { return(Game.AllPlayedCards.Select(z => z).Where(z => z.Suit == GameView.Suit("hearts")).FirstOrDefault() != null); }
private static bool HaveHigherCardInMatchingSuitNotHeartsOrSpades(Trick trick, Player player, string currentSuit) { return(HaveMatchingSuit(player, currentSuit) && HighestCardInMatchingSuit(player, currentSuit).Rank > trick.FirstCard.Rank && currentSuit != GameView.Suit("spades") && currentSuit != GameView.Suit("hearts") && (trick.Cards.Select(z => z.ValueInTrick).Sum() < 1)); }
private static Card HighestValueCardSpade(Player player) { return(player.Hand.OrderByDescending(z => z.ValueInTrick).Where(z => z.Suit == GameView.Suit("spades") && z.ValueInTrick > 5).FirstOrDefault()); }
private static Card HighestCardHeart(Player player) { return(player.Hand.OrderByDescending(z => z.Rank).Where(z => z.Suit == GameView.Suit("hearts")).FirstOrDefault()); }