public void StartNewGame() { PlayerOne = new Player(); PlayerTwo = new Dealer(); Deck = new Deck(); Deck.Shuffle(); PlayerOne.GiveCard(Deck.GetCard()); PlayerOne.GiveCard(Deck.GetCard()); PlayerTwo.GiveCard(Deck.GetCard()); PlayerTwo.GiveCard(Deck.GetCard()); }
public void StartNewGame() { // Create players - dealer and player. PlayerOne = new Player(); PlayerTwo = new Dealer(); // Create a new card deck. Shuffle it. Deck = new Deck(); Deck.Shuffle(); // Take two cards from the deck and give it to player. PlayerOne.GiveCard(Deck.GetCard()); PlayerOne.GiveCard(Deck.GetCard()); // Take two cards from the dek and give it to dealer. PlayerTwo.GiveCard(Deck.GetCard()); PlayerTwo.GiveCard(Deck.GetCard()); }
public void StartNewGame() { //create players - dealer and player PlayerOne = new Player(); PlayerTwo = new Dealer(); //create a new deck, shuffle it. Deck = new Deck(); Deck.Shuffle(); //Take two cards from the deck and give it to the player, dealer for (int count = 0; count >= 2; count++) { PlayerOne.GiveCard(Deck.GetCard()); PlayerTwo.GiveCard(Deck.GetCard()); } }
public void StartNewGame() { PlayerOne = new Player(); PlayerTwo = new Dealer(); Deck = new Deck(); Deck.Shuffle(); PlayerOne.GiveCard(Deck.GetCard()); PlayerOne.GiveCard(Deck.GetCard()); PlayerTwo.GiveCard(Deck.GetCard()); PlayerTwo.GiveCard(Deck.GetCard()); //garākais variants: //Card card1 = Deck.GetCard(); //PlayerOne.GiveCard(card1); }
public static ActionTable FromStrategy(IBlackjackPlayer strategy) { var table = new ActionTypes[35, 10]; List<PlayerHand> hands = new List<PlayerHand>(); hands.Add(null); for (int dealer = 0; dealer < 10; dealer++) { DealerHand dealerHand = new DealerHand(); dealerHand.AddCard(new Card((Ranks)dealer)); for (int p = 0; p < 35; p++) { PlayerHand playerHand = new PlayerHand() { Player = strategy, Bet = 1 }; if (p < 10) { playerHand.AddCard(new Card((Ranks)p)); playerHand.AddCard(new Card((Ranks)p)); } else if (p < 19) { playerHand.AddCard(new Card(Ranks.Ace)); playerHand.AddCard(new Card((Ranks)(p - 10))); } else if (p < 26) { playerHand.AddCard(new Card(Ranks.Two)); playerHand.AddCard(new Card((Ranks)(p - 18))); } else { playerHand.AddCard(new Card(Ranks.Ten)); playerHand.AddCard(new Card((Ranks)(p - 26))); } hands[0] = playerHand; HandInfo info = new HandInfo() { DealerHand = dealerHand, HandToPlay = 0, PlayerHands = hands }; var hs = strategy.Hit(info) ? ActionTypes.Hit : ActionTypes.Stand; var type = hs; if (p < 10 && strategy.Split(info)) type = hs == ActionTypes.Hit ? ActionTypes.SplitOrHit : ActionTypes.SplitOrStand; else if (strategy.DoubleDown(info)) type = hs == ActionTypes.Hit ? ActionTypes.DoubleDownOrHit : ActionTypes.DoubleDownOrStand; table[p, dealer] = type; } } return new ActionTable(table); }
public static ActionTable FromStrategy(IBlackjackPlayer strategy) { var table = new ActionTypes[35, 10]; List <PlayerHand> hands = new List <PlayerHand>(); hands.Add(null); for (int dealer = 0; dealer < 10; dealer++) { DealerHand dealerHand = new DealerHand(); dealerHand.AddCard(new Card((Ranks)dealer)); for (int p = 0; p < 35; p++) { PlayerHand playerHand = new PlayerHand() { Player = strategy, Bet = 1 }; if (p < 10) { playerHand.AddCard(new Card((Ranks)p)); playerHand.AddCard(new Card((Ranks)p)); } else if (p < 19) { playerHand.AddCard(new Card(Ranks.Ace)); playerHand.AddCard(new Card((Ranks)(p - 10))); } else if (p < 26) { playerHand.AddCard(new Card(Ranks.Two)); playerHand.AddCard(new Card((Ranks)(p - 18))); } else { playerHand.AddCard(new Card(Ranks.Ten)); playerHand.AddCard(new Card((Ranks)(p - 26))); } hands[0] = playerHand; HandInfo info = new HandInfo() { DealerHand = dealerHand, HandToPlay = 0, PlayerHands = hands }; var hs = strategy.Hit(info) ? ActionTypes.Hit : ActionTypes.Stand; var type = hs; if (p < 10 && strategy.Split(info)) { type = hs == ActionTypes.Hit ? ActionTypes.SplitOrHit : ActionTypes.SplitOrStand; } else if (strategy.DoubleDown(info)) { type = hs == ActionTypes.Hit ? ActionTypes.DoubleDownOrHit : ActionTypes.DoubleDownOrStand; } table[p, dealer] = type; } } return(new ActionTable(table)); }
public void AddPlayer(IBlackjackPlayer player) { _players.Add(player); }
private void CompleteHands(IBlackjackPlayer player) { foreach (var hand in player.Hands.Where(hand => hand.GetCards().Count == 1)) { hand.AddCard(Shoe.Deal()); } }