private void StopPulling() { var firstOccupiedHand = Hands.FirstOrDefault(hand => !hand.Enabled); if (firstOccupiedHand == null) { return; } EnableHand(firstOccupiedHand); }
private void StartPulling() { var firstFreeHand = Hands.FirstOrDefault(hand => hand.Enabled); if (firstFreeHand == null) { return; } DisableHand(firstFreeHand); }
public Hand?GetHand(string?name) { return(Hands.FirstOrDefault(hand => hand.Name == name)); }
public void ShowPlayerCards(bool hideOneCard = false) { if (hideOneCard) // This should be set to true only if the player is the dealer AND all players have played. { log.DealerCard(Name); if (Hands.FirstOrDefault().Cards.FirstOrDefault() != null) { Hands.First().Cards.First().DisplayCard(); } } else { foreach (Hand hand in Hands) { if (Name != "Dealer") { if (hand.Status == HandStatus.Bust) { log.PlayerHasBust(Name, Bet); } else if (hand.Status == HandStatus.BlackJack) { log.PlayerGotBlackJack(Name, Bet * blackJackPayout); } else if (hand.Status == HandStatus.Won) { log.PlayerHasWon(Name, Bet); } else if (hand.Status == HandStatus.Lost) { log.PlayerResult(Name, "lost"); } else if (hand.Status == HandStatus.BlackJack) { log.PlayerHasWon(Name, Bet * 1.5); } else if (hand.Status == HandStatus.Push && Name != "Dealer") { log.PlayerHasTied(Name); } else if (hand.Status == HandStatus.InPlay) { log.PlayerCardsInPlay(Name); } else { log.PlayerCards(Name); } } else { if (hand.Status == HandStatus.Bust) { log.PlayerResult(Name, "bust"); } else { log.PlayerCards(Name); } } foreach (Card card in hand.Cards) { card.DisplayCard(); } log.Total(hand.Total); } } log.SkipLine(); }