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