コード例 #1
0
        public void Redo()
        {
            if (StkRedo.Count == 0 || isSearching)
            {
                return;
            }
            if (StkUndo.Count > 0)
            {
                Point point = StkUndo.Peek();
                ChangeBackgroundColor(Matrix[point.Y][point.X], false);
            }
            Point undoPoint = StkRedo.Pop();

            StkUndo.Push(undoPoint);
            Button btn = Matrix[undoPoint.Y][undoPoint.X];

            DrawChess(GetChessPoint(btn), CurrentPlayer);
            ChangeBackgroundColor(btn, true);
            if (isEndGame(btn))
            {
                IsEndGame = CurrentPlayer == 1 ? ENDGAME.PlayerX : ENDGAME.PlayerO;
                Form.EndGame(Convert.ToInt32(IsEndGame));
            }
            else
            {
                ChangePlayer();
            }
        }
コード例 #2
0
        public void Undo()
        {
            if (stkUndo.Count == 0 || isSearching)
            {
                return;
            }
            Point undoPoint = StkUndo.Pop();

            StkRedo.Push(undoPoint);
            Button btn = Matrix[undoPoint.Y][undoPoint.X];

            ChangeBackgroundColor(btn, false);
            btn.Text = "";
            if (StkUndo.Count > 0)
            {
                Point point = StkUndo.Peek();
                ChangeBackgroundColor(Matrix[point.Y][point.X], true);
            }
            if (Ready)
            {
                ChangePlayer();
            }
            else
            {
                Form.resetTime(CurrentPlayer);
            }
        }