Beispiel #1
0
        private void ResetButtonClick(object sender, EventArgs e)
        {
            this.pauseButton.Enabled = false;
            this.runButton.Enabled = false;
            this.nextStepButton.Enabled = false;
            this.createFurnitureButton.Enabled = true;
            this.operationsStack.Items.Clear();

            this.ClearCombos();

            board = Board.Instance;
            board.Reset();
            pause = false;
            stripsLogic = null;

            this.BuildBoard();
        }
Beispiel #2
0
        private void PerformOperation(bool runAutomatically)
        {
            if (stripsLogic == null)
            {
                if (runAutomatically)
                {
                    this.pauseButton.Enabled = true;
                }
                stripsLogic = new Strips(board);
            }

            while (!board.IsBoardSolved())
            {
                if (pause)
                {
                    pause = false;
                    return;
                }

                Operation currOp = stripsLogic.GetNextOperation();
                this.ExecuteOperation(currOp);
                this.Invoke(new InteractivePauseDelegate(this.InteractivePause),new object[1]{new TimeSpan(0, 0, 0, 0, 500)});

                // perform one step
                if ((!runAutomatically) && (!pause))
                {
                    if (pause)
                    {
                        pause = false;
                    }
                    return;
                }
            }

            MessageBox.Show("Solved!!!");
            this.runButton.Enabled = false;
            this.nextStepButton.Enabled = false;
            this.pauseButton.Enabled = false;
        }