Пример #1
0
 /// <summary>
 /// Initializes a new instance of the CardInHand class.
 /// </summary>
 /// <param name="Parent">Placeholder for the Parent object.</param>
 /// <param name="MasterParent">Placeholder for the Master Parent object.</param>
 /// <param name="BaseCard">The card in which to hold this class's data.</param>
 public CardInHand(PlayerHandViewModel Parent, TableViewModel MasterParent, Card BaseCard)
 {
     m_Parent = Parent;
     m_MasterParent = MasterParent;
     m_Card = BaseCard;
     if (!m_MasterParent.HouseRulesVM.FastMode) { OnPropertyChanged("CardImage"); }
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the Shoe class.
 /// </summary>
 public ShoeViewModel(TableViewModel Parent, bool IsBenchmark = false)
 {
     m_MasterParent = Parent;
     m_ShoeModel = new ShoeModel();
     IsBenchmark = false;
     ResetShoe();
 }
 /// <summary>
 /// Initializes a new instance of the PlayerHandViewModel class.
 /// </summary>
 /// <param name="ParentTVM">Placeholder for the parent MasterViewModel.</param>
 /// <param name="ParentPVM">Placeholder for the parent PlayerViewModel.</param>
 public PlayerHandViewModel(TableViewModel ParentTVM, PlayerViewModel ParentPVM)
 {
     m_MasterParent = ParentTVM;
     m_ParentPlayerViewModel = ParentPVM;
     m_PlayerHandModel = new PlayerHandModel();
     m_PlayerStrategyViewModel = new PlayerStrategyViewModel(m_MasterParent, this);
 }
 /// <summary>
 /// Initializes a new instance of the BenchmarkViewModel class.
 /// </summary>
 /// <param name="Parent">Placeholder for the parent object.</param>
 public BenchmarkViewModel(TableViewModel Parent)
 {
     m_Parent = Parent;
     m_BenchmarkModel = new BenchmarkModel();
     SecondsPerBenchmark = 3;
     RunType = "Create Shoe";
     RunSubType = "Fisher-Yates Shfle";
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the DealerCardInHand class.
 /// </summary>
 /// <param name="Parent">Placeholder for the Parent object.</param>
 /// <param name="MasterParent">Placeholder for the Master Parent object.</param>
 /// <param name="BaseCard">The card in which to hold this class's data.</param>
 /// <param name="ShowCard">Whether or not the card is shown face up or face down.</param>
 public DealerCardInHand(DealerHandViewModel Parent, TableViewModel MasterParent, Card BaseCard, bool ShowCard)
 {
     m_MasterParent = MasterParent;
     m_Parent = Parent;
     m_Card = BaseCard;
     m_IsShowing = ShowCard;
     if (!m_MasterParent.HouseRulesVM.FastMode) { OnPropertyChanged("CardImage"); }
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the PlayerViewModel class.
 /// </summary>
 /// <param name="Parent">Placeholder for the parent object.</param>
 /// <param name="PlayerNum">Indicates the player number.</param>
 public PlayerViewModel(TableViewModel Parent, int PlayerNum)
 {
     m_MasterParent = Parent;
     m_PlayerModel = new PlayerModel();
     PlayerHandVM = new PlayerHandViewModel[4];
     PlayerHandVM[0] = new PlayerHandViewModel(m_MasterParent, this);
     PlayerHandVM[1] = new PlayerHandViewModel(m_MasterParent, this);
     PlayerHandVM[2] = new PlayerHandViewModel(m_MasterParent, this);
     PlayerHandVM[3] = new PlayerHandViewModel(m_MasterParent, this);
     m_PlayerModel.Name = String.Format("Player {0}", PlayerNum);
 }
 private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     MasterViewModel = (TableViewModel)DataContext;
     DealerSeat.DataContext = MasterViewModel.DealerVM;
     Player1Seat.DataContext = MasterViewModel.PlayerVM[0];
     Player2Seat.DataContext = MasterViewModel.PlayerVM[1];
     Player3Seat.DataContext = MasterViewModel.PlayerVM[2];
     Player4Seat.DataContext = MasterViewModel.PlayerVM[3];
     Player5Seat.DataContext = MasterViewModel.PlayerVM[4];
     Player6Seat.DataContext = MasterViewModel.PlayerVM[5];
     Player7Seat.DataContext = MasterViewModel.PlayerVM[6];
 }
 /// <summary>
 /// Runs a specific benchmark for a specified number of seconds.
 /// </summary>
 /// <param name="Benchmark">Type of Benchmark to run.</param>
 private void RunSingleBenchmark(BenchmarkType Benchmark)
 {
     CanStartBenchmark = false;
     BenchmarkResults Results = new BenchmarkResults();
     DateTime StartTime, EndTime;
     TableViewModel tempMasterViewModel = new TableViewModel();
     #region Temp MasterViewModel Settings
     tempMasterViewModel.HouseRulesVM.DecksInShoe = 7;
     tempMasterViewModel.HouseRulesVM.ShoePenetration = 0.75;
     #endregion
     Results.Type = Benchmark;
     Results.Iterations = 0;
     StartTime = DateTime.Now;
     EndTime = StartTime.AddSeconds(SecondsPerBenchmark);
     switch (Benchmark) {
         case BenchmarkType.CreateShoeFisherYates:
             #region Create Shoe - Fisher-Yates Shuffle
             Results.Name = "Create Shoe - Fisher-Yates Shuffle";
             tempMasterViewModel.HouseRulesVM.ShuffleMode = ShuffleMode.FisherYates;
             while (DateTime.Now < EndTime) {
                 ShoeViewModel Shoe = new ShoeViewModel(tempMasterViewModel, true);
                 Results.Iterations++;
             }
             break;
             #endregion
         case BenchmarkType.NoShuffle:
             #region Create Shoe - No Shuffle
             Results.Name = "Create Shoe - No Shuffle";
             tempMasterViewModel.HouseRulesVM.ShuffleMode = ShuffleMode.NoShuffle;
             while (DateTime.Now < EndTime) {
                 ShoeViewModel Shoe = new ShoeViewModel(tempMasterViewModel, true);
                 Results.Iterations++;
             }
             break;
             #endregion
     }
     Results.RunTime = DateTime.Now.Subtract(StartTime).TotalMilliseconds / 1000;
     Results.IterationsPerSecond = Math.Round(Results.Iterations / Results.RunTime, 2);
     Results.RunTime = Math.Round(Results.RunTime, 2);
     BenchmarkData[Benchmark] = Results;
     m_Parent.LoggingVM.AddItem(LogActionType.Benchmark, Results);
     OnPropertyChanged("DataTable");
     tempMasterViewModel.Dispose();
     CanStartBenchmark = true;
 }
 /// <summary>
 /// Initializes a new instance of the DealerHandViewModel class.
 /// </summary>
 /// <param name="ParentTVM">Placeholder for the parent MasterViewModel.</param>
 /// <param name="ParentDVM">Placeholder for the parent DealerViewModel.</param>
 public DealerHandViewModel(TableViewModel ParentTVM, DealerViewModel ParentDVM)
 {
     m_MasterParent = ParentTVM;
     m_ParentDealerViewModel = ParentDVM;
     m_DealerHandModel = new DealerHandModel();
 }
 /// <summary>
 /// Initializes a new instance of the PlayerStrategyViewModel class.
 /// </summary>
 /// <param name="Parent">Placeholder for the parent object.</param>
 /// <param name="ParentPHVM">Placeholder for the parent player hand view model object.</param>
 public PlayerStrategyViewModel(TableViewModel Parent, PlayerHandViewModel ParentPHVM)
 {
     m_Parent = Parent;
     m_ParentPlayerHandViewModel = ParentPHVM;
     m_PlayerStrategyModel = new PlayerStrategyModel();
 }
 /// <summary>
 /// Initializes a new instance of the HouseRulesViewModel class.
 /// </summary>
 /// <param name="Parent">Placeholder for the parent object.</param>
 public HouseRulesViewModel(TableViewModel Parent)
 {
     m_MasterParent = Parent;
     m_HouseRulesModel = new HouseRulesModel();
 }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the LoggingViewModel class.
 /// </summary>
 /// <param name="Parent">Placeholder for the parent object.</param>
 public LoggingViewModel(TableViewModel Parent)
 {
     m_MasterParent = Parent;
     m_LoggingModel = new LoggingModel();
 }
 /// <summary>
 /// Initializes a new instance of the GameStatisticsViewModel class.
 /// </summary>
 /// <param name="Parent">Placeholder for the parent object.</param>
 public GameStatisticsViewModel(TableViewModel Parent)
 {
     m_MasterParent = Parent;
     m_GameStatisticsModel = new GameStatisticsModel();
     Reset();
 }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of the MainWindow class.
 /// </summary>
 /// <param name="ParentTVM">Parent TableViewModel object.</param>
 public MainWindow(TableViewModel ParentTVM)
 {
     InitializeComponent();
     TableViewModel = ParentTVM;
     BlackJackTable.DataContext = TableViewModel;
     ShoeContentsTabItem.DataContext = TableViewModel.ShoeVM;
     DebugLogTabItem.DataContext = TableViewModel.LoggingVM;
     BenchmarkTabItem.DataContext = TableViewModel.BenchmarkVM;
     HouseRulesTabItem.DataContext = TableViewModel.HouseRulesVM;
     DataContext = TableViewModel;
     AutoPlayTimer.Interval = TimeSpan.FromTicks(1);
     AutoPlayTimer.Tick += new EventHandler(Tick);
 }
Пример #15
0
 /// <summary>
 /// Initializes a new instance of the ResourcesViewModel class.
 /// </summary>
 /// <param name="Parent">Placeholder for parent object.</param>
 public ResourcesViewModel(TableViewModel Parent)
 {
     m_Parent = Parent;
     m_ResourcesModel = new ResourcesModel();
     CardLoad();
 }