public void Deal() { // >>>>>[ Clear Player and Dealer's hand. // ----- Player.NewHand(); Dealer.NewHand(); // >>>>>[ Shuffle the deck. // ----- Dealer.Shuffle(); // >>>>>[ Initial Deal // ----- for (int SubIndex = 0; SubIndex < 2; SubIndex++) { Player.AddToHand(Dealer.Deal()); Dealer.AddToHand(Dealer.Deal()); } FlavorText.Clear(); ResultText.Clear(); // >>>>>[ Dealer checks for Blackjack. No blackjack? // Play proceeds as normal... // ----- FlavorText.Add("+----"); FlavorText.Add("The dealer takes a peek at her face-down card... "); if (Dealer.PlayerHand[0].IsBlackjack()) { FlavorText.Add("Dealer has Blackjack!"); DealerGo(true); } else { Commands["split"] = Player.CanSplit; View.ModelChanged(); } }
public BlackjackModel(BlackjackDealer Dealer, BlackjackPlayer Player) { // >>>>>[ For now keeping it simple: One player, one view. // - jds | 2019.01.30 // ----- this.Dealer = Dealer; this.Player = Player; Dealer.NewHand(); Player.NewHand(); // >>>>>[ Populate the command list. Initially, the only available // command will be "Bet". // -jds | 2019.01.31 // ----- this.Commands.Add("bet", true); this.Commands.Add("hit", false); this.Commands.Add("stand", false); this.Commands.Add("double down", false); this.Commands.Add("restart", true); this.Commands.Add("surrender", false); this.Commands.Add("split", false); this.Commands.Add("quit", true); }