/*
         *
         * private async void ComputerDeck()
         * {
         *  var deck = Cards.FullDeck;
         *  foreach (var card in deck)
         *  {
         *
         *
         *  }
         * }
         */


        private Cards.Card DrawTopCardFromDeck()
        {
            var top = RemainingDeck[RemainingDeck.Count - 1];

            RemainingDeck.Remove(top);
            return(top);
        }
Example #2
0
 private void TakeCardFromDeck(Cards.Card card)
 {
     if (humanTurn)
     {
         RemainingDeck.Remove(card);
         HumanCards.Add(card);
     }
 }
 private void TakeCardFromDeck(Cards.Card card)
 {
     if (!takenFromDeckOrDiscardPile)  // Human goes first
     {
         RemainingDeck.Remove(card);
         HumanCards.Add(card);
         takenFromDeckOrDiscardPile = true;
         canNowDiscard = true;
     }
 }
Example #4
0
        private void ComputerTurn()
        {
            var takeDiscard = ComputerPlayer.ComputerPickupDiscard(ComputerCards, Discards[Discards.Count - 1], RemainingDeck);

            if (takeDiscard)
            {
                var discardCard = Discards[Discards.Count - 1];
                Discards.Remove(discardCard);
                ComputerCards.Add(discardCard);
            }
            else
            {
                Cards.Card remainingDeckCards = RemainingDeck[RemainingDeck.Count - 1];
                RemainingDeck.Remove(remainingDeckCards);
                ComputerCards.Add(remainingDeckCards);
            }

            var compMove = ComputerPlayer.ComputerMove(ComputerCards);

            ComputerCards.Remove(compMove.Item2.Value);
            Discards.Add(compMove.Item2.Value);

            var scores = GinRummy.Score(ComputerCards, HumanCards);

            if (compMove.Item1.IsGin)
            {
                compScore += scores;
                if (humanScore < 100 && compScore < 100)
                {
                    RaiseNotification("Human Score: " + humanScore + ". Computer Score: " + compScore, "Scores So Far");
                    CleanUpCards();
                }
            }
            else if (compMove.Item1.IsKnock)
            {
                if (scores > 0)
                {
                    compScore += scores;
                    if (humanScore < 100 && compScore < 100)
                    {
                        RaiseNotification("Human Score: " + humanScore + ". Computer Score: " + compScore, "Scores So Far");
                        CleanUpCards();
                    }
                }
                else
                {
                    humanScore += Math.Abs(scores);
                    if (humanScore < 100 && compScore < 100)
                    {
                        RaiseNotification("Human Score: " + humanScore + ". Computer Score: " + compScore, "Scores So Far");
                        CleanUpCards();
                    }
                }
            }
        }
Example #5
0
 private void TakeCardFromDeck(Cards.Card card)
 {
     if (!humanDraw)
     {
         RemainingDeck.Remove(card);
         HumanCards.Add(card);
         humanDraw = true;
     }
     else
     {
         RaiseNotification("You already take a card", "Invalid Action");
     }
 }
Example #6
0
 private void TakeCardFromDeck(Cards.Card card)
 {
     if (pickUpStage)
     {
         RemainingDeck.Remove(card);
         HumanCards.Add(card);
         pickUpStage  = false;
         discardStage = true;
     }
     else
     {
         RaiseNotification("Not in Pick-Up Stage", "Title");
     }
 }
Example #7
0
 private void ComputerTakeCardFromDiscardPile()
 {
     Cards.Card topDiscard = Discards[Discards.Count - 1];
     if (humanDraw)
     {
         bool computerPickUp = ComputerPlayer.ComputerPickupDiscard(ComputerCards, topDiscard, PossibleDeck);
         if (computerPickUp)
         {
             ComputerCards.Add(topDiscard);
             Discards.Remove(topDiscard);
             humanDraw = false;
             ComputerDiscardCardFromHand();
         }
         else
         {
             var topHiddenCard = RemainingDeck[RemainingDeck.Count - 1];
             ComputerCards.Add(topHiddenCard);
             PossibleDeck.Remove(topHiddenCard);
             RemainingDeck.Remove(topHiddenCard);
             humanDraw = false;
             ComputerDiscardCardFromHand();
         }
     }
 }