예제 #1
0
        private void NewGameButton_Click(object sender, EventArgs e)
        {
            // ignore new game requests if the ai is running
            if (aiThinking)
            {
                return;
            }

            okToRotateQuadrant = false;
            okToClickDots      = false;

            UpperLeft.Reset();
            UpperRight.Reset();
            LowerLeft.Reset();
            LowerRight.Reset();

            PopupPanel.Visibility = System.Windows.Visibility.Collapsed;

            masterBoard = new Board();

            this.currentGameStyle = settings.GameStyleSetting;

            if (this.currentGameStyle == GameStyle.VsAi && settings.PlayerColorSetting == PieceColor.Black)
            {
                playerColor = PieceColor.Black;

                if (0 == settings.AiStrengthSetting)
                {
                    Debug.Assert(false, "Easy");
                    masterAI = new FixedDepthPlayer(PieceColor.White, 0);
                }
                else if (1 == settings.AiStrengthSetting)
                {
                    Debug.Assert(false, "Med");
                    masterAI = new FixedDepthPlayer(PieceColor.White, 2);
                }
                else
                {
                    Debug.Assert(false, "Hard");
                    masterAI = new FixedTimePlayer(PieceColor.White, 5);
                }

                aiThinking = true;
                DoAiMove();
            }
            else if (this.currentGameStyle == GameStyle.VsAi && settings.PlayerColorSetting == PieceColor.White)
            {
                playerColor = PieceColor.White;
                if (0 == settings.AiStrengthSetting)
                {
                    masterAI = new FixedDepthPlayer(PieceColor.Black, 0);
                }
                else if (1 == settings.AiStrengthSetting)
                {
                    masterAI = new FixedDepthPlayer(PieceColor.Black, 2);
                }
                else
                {
                    masterAI = new FixedTimePlayer(PieceColor.Black, 5);
                }
                okToClickDots      = true;
                okToRotateQuadrant = false;
                BottomText.Text    = "your move";
            }
            else if (this.currentGameStyle == GameStyle.VsHuman)
            {
                playerColor = PieceColor.White;

                okToClickDots      = true;
                okToRotateQuadrant = false;
                BottomText.Text    = "white's move";
            }
        }
예제 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            // ignore new game requests if the ai is running
            if (aiThinking)
            {
                return;
            }

            HowTo.Visibility     = Visibility.Collapsed;
            HowToText.Visibility = Visibility.Collapsed;

            okToRotateQuadrant = false;
            okToClickDots      = false;

            UpperLeft.Reset();
            UpperRight.Reset();
            LowerLeft.Reset();
            LowerRight.Reset();

            masterBoard = new Board();

            if ((bool)playerBlackRadioButton.IsChecked)
            {
                playerColor = PieceColor.Black;

                if ((bool)aiEasyRadioButton.IsChecked)
                {
                    Debug.Assert(false, "Easy");
                    masterAI = new FixedDepthPlayer(PieceColor.White, 0);
                }
                else if ((bool)aiMediumRadioButton.IsChecked)
                {
                    Debug.Assert(false, "Med");
                    masterAI = new FixedDepthPlayer(PieceColor.White, 2);
                }
                else
                {
                    Debug.Assert(false, "Hard");
                    masterAI = new FixedTimePlayer(PieceColor.White, 5);
                }

                aiThinking = true;
                DoAiMove();
            }
            else
            {
                playerColor = PieceColor.White;
                if ((bool)aiEasyRadioButton.IsChecked)
                {
                    masterAI = new FixedDepthPlayer(PieceColor.Black, 0);
                }
                else if ((bool)aiMediumRadioButton.IsChecked)
                {
                    masterAI = new FixedDepthPlayer(PieceColor.Black, 2);
                }
                else
                {
                    masterAI = new FixedTimePlayer(PieceColor.Black, 5);
                }
                okToClickDots      = true;
                okToRotateQuadrant = false;
                BottomText.Text    = "Your move";
            }
        }