/* * * 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); }
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; } }
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(); } } } }
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"); } }
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"); } }
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(); } } }