public Table(Dealer dealer, Shoe shoe, DiscardTray discardTray) { Dealer = dealer; Shoe = shoe; DiscardTray = discardTray; Players = new List <Player>(); }
public void Sweep(DiscardTray discardTray, Hand hand) { foreach (Card card in hand.Cards) { discardTray.Cards.Add(card); } hand.Cards.Clear(); }
public void Shuffle(Shoe shoe, DiscardTray discardTray) { var allCards = shoe.Cards.Concat(discardTray.Cards).ToList(); var shuffledCards = new List <Card>(); while (allCards.Any()) { var index = random.Next(allCards.Count); shuffledCards.Add(allCards.ElementAt(index)); allCards.RemoveAt(index); } shoe.Reload(shuffledCards); }
public void Burn(Shoe shoe, DiscardTray discardTray) { discardTray.Cards.Add(shoe.NextCard()); }
static void Main(string[] args) { //var dealerHand = new DealerHand(); //dealerHand.Deal(new Card(CardType.Ace, SuitType.Spades)); //dealerHand.Deal(new Card(CardType.Jack, SuitType.Diamonds)); //dealerHand.IsTurnPending = false; //dealerHand.Draw(); //var playerHand = new PlayerHand(); //playerHand.Deal(new Card(CardType.Five, SuitType.Spades)); //playerHand.Deal(new Card(CardType.Six, SuitType.Diamonds)); //playerHand.Deal(new Card(CardType.Two, SuitType.Hearts)); //playerHand.Draw(); var dealer = new Dealer(); var shoe = new Shoe(); var discardTray = new DiscardTray(); var table = new Table(dealer, shoe, discardTray); table.InvitePlayers(); table.Play(); //var player1 = new Player("John", 500); //table.Players.Add(player1); //player1.Hands.Add(new PlayerHand(player1, 10)); //dealer.Shuffle(shoe, discardTray); //dealer.Slice(shoe); //dealer.Burn(shoe, discardTray); //dealer.Deal(shoe, dealer.Hand); //dealer.Deal(shoe, dealer.Hand); //dealer.Deal(shoe, player1.Hands[0]); //dealer.Deal(shoe, player1.Hands[0]); //table.Draw(); //Thread.Sleep(2000); //player1.Hands[0].Win(); //dealer.Hand.Lose(); //dealer.Sweep(discardTray, player1.Hands[0]); //dealer.Sweep(discardTray, dealer.Hand); //player1.Hands.Remove(player1.Hands[0]); //table.Draw(); //var player = new Player("Will", 500); //player.Hands.Add(new PlayerHand(player, 10)); //player.Hands[0].Deal(new Card(CardType.Six, SuitType.Diamonds)); //player.Hands[0].Deal(new Card(CardType.Six, SuitType.Spades)); //player.Hands[0].Split(); //player.Draw(); //var table = new Table(new Dealer(), new Shoe(Table.SHOE_SIZE), new DiscardTray(), new List<Player>()); //InvitePlayers(table); //while (table.HasPlayers) //{ // BootBrokePlayers(table); // if (table.HasPlayers) // { // PlaceBets(table); // Deal(table); // } //} }