예제 #1
0
        private void myWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            Button b = (Button)grid.Children[12 * (int)AI.X + (int)AI.Y];

            if ((int)AI.X % 2 == 0 && (int)AI.Y % 2 == 0 || (int)AI.X % 2 != 0 && (int)AI.Y % 2 != 0)
            {
                setBackground(b, p2);
            }
            else
            {
                setBackground(b, p2_1);
            }

            player2.mark((int)AI.X, (int)AI.Y);

            BoardMerge[(int)AI.X, (int)AI.Y] = 2;

            int result2 = player2.check((int)AI.X, (int)AI.Y);

            if (result2 != 0)
            {
                MessageBox.Show("AI win!");
                //highlight dong win
                highlight(player2, result2, p2_h);
                isWin = true;
            }
        }
예제 #2
0
        //highlight dòng win online
        public void onlineHighLight()
        {
            int result1 = player1.check((int)online_me.X, (int)online_me.Y);

            if (result1 != 0)
            {
                //highlight dong win
                highlight(player1, result1, p1_h);
                isAIOnlineWin = true;

                return;
            }

            int result2 = player2.check((int)onlineStep.X, (int)onlineStep.Y);

            if (result2 != 0)
            {
                //highlight dong win
                highlight(player2, result2, p2_h);
                isAIOnlineWin = true;

                return;
            }
        }