示例#1
0
        private void CompVComp_click(object sender, EventArgs e)
        {
            string AIone_choice = "";
            string AItwo_choice = "";

            // user chooses computer AI #1 difficulty
            difficulty AIone = new difficulty("Pick AI 1");

            AIone.ShowDialog();
            AIone_choice = difficulty.PickAI;

            // user chooses computer AI #2 difficulty
            difficulty AItwo = new difficulty("Pick AI 2");

            AItwo.ShowDialog();
            AItwo_choice = difficulty.PickAI;

            // user can choose a game size
            size s = new size();

            s.ShowDialog();
            int game_size = size.SetTheSize;
            int rows      = getRows(game_size);
            int cols      = getCols(game_size);

            s.Hide();

            // if the menus weren't closed
            if (game_size != 0 && AIone_choice != "" && AItwo_choice != "")
            {
                // make the gameboard and start playing
                GameBoard game = new GameBoard(0, AIone_choice, AItwo_choice, rows, cols);
                if (game_size == 1)
                {
                    game.Size = new Size(600, 450);
                }
                else if (game_size == 3)
                {
                    game.Size = new Size(1200, 900);
                }
                game.Show();
            }
        }
示例#2
0
        private void HumanVComp_click(object sender, EventArgs e)
        {
            // user chooses computer difficulty
            difficulty d = new difficulty("Pick AI");

            d.ShowDialog();
            string AI = difficulty.PickAI;


            // user can choose a game size
            size s = new size();

            s.ShowDialog();
            int game_size = size.SetTheSize;
            int rows      = getRows(game_size);
            int cols      = getCols(game_size);

            s.Hide();

            // if the menus weren't closed
            if (game_size != 0 && AI != "")
            {
                // make the gameboard and start playing
                GameBoard game = new GameBoard(1, AI, "", rows, cols);
                if (game_size == 1)
                {
                    game.Size = new Size(600, 450);
                }
                else if (game_size == 3)
                {
                    game.Size = new Size(1200, 900);
                }
                game.Show();
                this.Hide();
            }
        }