Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 private static Card LowestCardNotHeart(Player player)
 {
     return(player.Hand.OrderBy(z => z.Rank).Where(z => z.Suit != GameView.Suit("hearts")).FirstOrDefault());
 }
Esempio n. 4
0
 private static Card LowestCardSpade(Player player)
 {
     return(player.Hand.OrderBy(z => z.Rank).Where(z => z.Suit == GameView.Suit("spades")).FirstOrDefault());
 }
Esempio n. 5
0
 private static bool AtLeastOneNotHeartInHand(Player player)
 {
     return(player.Hand.Where(z => z.Suit != GameView.Suit("hearts")).FirstOrDefault() != null);
 }
Esempio n. 6
0
 private static bool AtLeastOneHeartWasPlayed()
 {
     return(Game.AllPlayedCards.Select(z => z).Where(z => z.Suit == GameView.Suit("hearts")).FirstOrDefault() != null);
 }
Esempio n. 7
0
 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));
 }
Esempio n. 8
0
 private static Card HighestValueCardSpade(Player player)
 {
     return(player.Hand.OrderByDescending(z => z.ValueInTrick).Where(z => z.Suit == GameView.Suit("spades") && z.ValueInTrick > 5).FirstOrDefault());
 }
Esempio n. 9
0
 private static Card HighestCardHeart(Player player)
 {
     return(player.Hand.OrderByDescending(z => z.Rank).Where(z => z.Suit == GameView.Suit("hearts")).FirstOrDefault());
 }