コード例 #1
0
        internal void ShowMove()
        {
            chessView.UpdateVisual(Board);
            ReportOutcome();

            if (MidGame)
            {
                if ((CurrentTurn == PieceColor.White && !WhiteHumanPlayer) ||
                    (CurrentTurn == PieceColor.Black && !BlackHumanPlayer))
                {
                    Adam adam = new Adam(this);
                    adam.RunSimulation(MaxSeconds);
                    chessView.ShowProcessingBar(MaxSeconds);
                }
            }
        }
コード例 #2
0
ファイル: ChessView.xaml.cs プロジェクト: awisaac/ChessGame
        private void NewGame_Click(object sender, RoutedEventArgs e)
        {
            if (engine.MidGame)
            {
                // Configure the message box to be displayed
                string           messageBoxText = "Do you want to start a new game?";
                string           caption        = "New Game";
                MessageBoxButton button         = MessageBoxButton.YesNoCancel;
                MessageBoxImage  icon           = MessageBoxImage.Warning;

                MessageBoxResult response = MessageBox.Show(messageBoxText, caption, button, icon);

                if (response == MessageBoxResult.Yes)
                {
                    engine.SetUpPieces();

                    if (!engine.WhiteHumanPlayer)
                    {
                        Adam adam = new Adam(engine);
                        adam.RunSimulation(engine.MaxSeconds);
                        ShowProcessingBar(engine.MaxSeconds);
                    }
                }
            }
            else
            {
                engine.SetUpPieces();

                if (!engine.WhiteHumanPlayer)
                {
                    Adam adam = new Adam(engine);
                    adam.RunSimulation(engine.MaxSeconds);
                    ShowProcessingBar(engine.MaxSeconds);
                }
            }
        }