bool PlayHand(Player player, Card dealerTopCard, Shoe shoe) { PlayAction play = player.Play(player.Hand, dealerTopCard); if (play == PlayAction.Stay) { return(true); } if (play == PlayAction.Hit) { Card card = shoe.GetNextCard(); bool bust = player.TakeCard(card); if (bust) { return(false); } return(PlayHand(player, dealerTopCard, shoe)); } if (play == PlayAction.Double) { if (player.Hand.Count() != 2) { throw new Exception("only double on first"); } var bust = player.TakeCard(shoe.GetNextCard()); if (bust) { return(false); } return(true); } throw new InvalidOperationException("shouldn't be here"); }
Card SeedTable(Player[] players, Player dealer, Shoe shoe) { players.ForEach(x => x.TakeCard(shoe.GetNextCard())); dealer.TakeCard(shoe.GetNextCard()); players.ForEach(x => x.TakeCard(shoe.GetNextCard())); Card dealerTopCard = shoe.GetNextCard(); dealer.TakeCard(dealerTopCard); return(dealerTopCard); }
bool PlayHand(Player player, Card dealerTopCard, Shoe shoe) { PlayAction play = player.Play(player.Hand, dealerTopCard); if (play == PlayAction.Stay) { return true; } if (play == PlayAction.Hit) { Card card = shoe.GetNextCard(); bool bust = player.TakeCard(card); if (bust) return false; return PlayHand(player, dealerTopCard, shoe); } if (play == PlayAction.Double) { if (player.Hand.Count() != 2) throw new Exception("only double on first"); var bust = player.TakeCard(shoe.GetNextCard()); if (bust) return false; return true; } throw new InvalidOperationException("shouldn't be here"); }
Card SeedTable(Player[] players, Player dealer, Shoe shoe) { players.ForEach(x => x.TakeCard(shoe.GetNextCard())); dealer.TakeCard(shoe.GetNextCard()); players.ForEach(x => x.TakeCard(shoe.GetNextCard())); Card dealerTopCard = shoe.GetNextCard(); dealer.TakeCard(dealerTopCard); return dealerTopCard; }
public Card Deal() { return(_shoe.GetNextCard()); }