コード例 #1
0
        public FormPlayVsComputer(Setting settingE)
        {
            InitializeComponent();
            grid = new int[3, 3];
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    grid[i, j] = 0;
                }
            }
            setting = settingE;
            int level = setting.difficultyLevel;

            if (level == 1)
            {
                playModel = new Easy(1, -1);
            }
            else if (level == 2)
            {
                playModel = new Medium(1, -1);
            }
            else if (level == 3)
            {
                playModel = new Hard(1, -1);
            }

            bool b = !setting.isStartedByPC;

            playModel.setStarted(b);
            setting.isStartedByPC = b;
            if (b)
            {
                playModel.pcPlay(grid, playModel.pcMark);
                this.refreshVal();
            }
            lblscorecomputer.Text = setting.current[1].ToString();
            lblscoreplayer.Text   = setting.current[2].ToString();
        }
コード例 #2
0
        public FormPlayVsComputer(Setting settingE)
        {
            InitializeComponent();
            grid = new int[3, 3];
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    grid[i, j] = 0;
                }
            }
            setting = settingE;
            int level=setting.difficultyLevel;
            if (level == 1)
            {
                playModel = new Easy(1, -1);
            }
            else if (level == 2) {

                playModel = new Medium(1, -1);
            }
            else if (level == 3)
            {
                playModel = new Hard(1, -1);
            }

            bool b = !setting.isStartedByPC;
            playModel.setStarted(b);
            setting.isStartedByPC = b;
            if (b)
            {
                playModel.pcPlay(grid, playModel.pcMark);
                this.refreshVal();
            }
            lblscorecomputer.Text = setting.current[1].ToString();
            lblscoreplayer.Text = setting.current[2].ToString();
        }