private void button1_Click(object sender, RoutedEventArgs e) { this.DeckCount = int.Parse(txt_Decks.Text); this.DeckIter = int.Parse(txt_DeckIter.Text); this.DevIter = int.Parse(txt_DevIter.Text); if (radio_Durstenfeld.IsChecked.Value) { this.shuffleType = Deck.ShuffleType.Durstenfeld; } else if (radio_Sullivan.IsChecked.Value) { this.shuffleType = Deck.ShuffleType.Sullivan; } else if (radio_Other.IsChecked.Value) { this.shuffleType = Deck.ShuffleType.Other; } ThreadStart threadStart = new ThreadStart(runRunner); Thread thread = new Thread(threadStart); thread.Start(); button1.Visibility = System.Windows.Visibility.Hidden; }
public Runner(Delegate progressBarCodeDelegate, Delegate updateDeviationIterationDelegate, int iterationsForDeviationAdjutment, int iterationsOfEntireDeck, int deckCount, Deck.ShuffleType shuffleType) { // Add code to loop through and create multiple Player_Statistics objects, and then // Look at the Deviations after averaging the results. this.PS_NoHit = new List <Player_Statistics>(); this.PS_Hit = new List <Player_Statistics>(); for (int x = 0; x < iterationsForDeviationAdjutment; x++) { // Update the Deviation Iteration Label object[] obj = new object[2]; obj[0] = iterationsForDeviationAdjutment - x; updateDeviationIterationDelegate.DynamicInvoke((Object)obj); // Get the required player statistics... BlackJack BJ = new BlackJack(deckCount, true, 1, 0, "C:/BlackJack/blackJack_iter" + x.ToString() + "_0Hit.txt", false, progressBarCodeDelegate, iterationsOfEntireDeck, shuffleType); Player_Statistics PS_NoHit = BJ.start(); BJ = new BlackJack(deckCount, true, 1, 1, "C:/BlackJack/blackJack_iter" + x.ToString() + "_1Hit.txt", false, progressBarCodeDelegate, iterationsOfEntireDeck, shuffleType); Player_Statistics PS_Hit = BJ.start(); this.PS_NoHit.Add(PS_NoHit); this.PS_Hit.Add(PS_Hit); } }
public BlackJack(int DeckCount, Boolean H17, int PlayerCount, int hitCount, String outputFile, Boolean reportByFirstTwoCards, Delegate progressUpdateCodeDelegate, int iterationsOfEntireDeck, Deck.ShuffleType shuffleType) { deck = new Deck(DeckCount, shuffleType); dealer = new Dealer(H17, this.deck); players = new List <Player>(); for (int x = 0; x < PlayerCount; x++) { players.Add(new Player(hitCount)); } this.outputFile = outputFile; this.reportByFirstTwoCards = reportByFirstTwoCards; this.progressUpdateCodeDelegate = progressUpdateCodeDelegate; this.iterationsOfEntireDeck = iterationsOfEntireDeck; }