示例#1
0
        public void Visualize(AiProperty player1AiProperty, AiProperty player2AiProperty)
        {
            Activate();

            _aiProperties = new[] { player1AiProperty, player2AiProperty };

            GameLogger = new Logger {
                EnableWritingConsole = true
            };

            AiLoggers[0] = new AiLogger();
            AiLoggers[1] = new AiLogger();

            Player1NameTextBlock.Text = "Player1";
            Player2NameTextBlock.Text = "Player2";

            StartGame();
        }
        private void RunGameVsHuman()
        {
            Window.Dispatcher.BeginInvoke(new Action(() => {
                RandomTextBox.Text = _random.Next() + "";

                var visualizeWindow = new VisualizeVsHumanWindow(GameConfig);
                visualizeWindow.Show();
                var player1Property = Player1IsHumanCheckBox.IsChecked.GetValueOrDefault()
                    ? AiProperty.CreateHumanProperty()
                    : AiProperty.CreateProperty(Player1FileName);
                var player2Property = Player2IsHumanCheckBox.IsChecked.GetValueOrDefault()
                    ? AiProperty.CreateHumanProperty()
                    : AiProperty.CreateProperty(Player2FileName);
                visualizeWindow.Visualize(player1Property, player2Property);
                _visualizeWindow?.Close();
                _visualizeWindow = visualizeWindow;

                StopGame();
            }));
        }