Example #1
0
        private void buttonNew_Click(object sender, EventArgs e)
        {
            timer.Stop();
            MazeDrawer.CalculateSize(this.panel1.CreateGraphics(), (int)numericUpDownPathSize.Value, (int)numericUpDownWallSize.Value, out this.mazeWidth, out this.mazeHeight);
            this.Maze = new Maze(this.mazeHeight, this.mazeWidth);
            this.MazeDrawer = new MazeDrawer(this.panel1.CreateGraphics(), this.Maze, (int)numericUpDownPathSize.Value, (int)numericUpDownWallSize.Value);
            this.MazeDrawer.BuildColor = this.buttonBuildColor.BackColor;
            this.MazeDrawer.BuildBackColor = this.buttonBuildBacktrackColor.BackColor;
            this.MazeDrawer.ExploreColor = Color.Red;
            this.MazeDrawer.ExploreBackColor = Color.Yellow;
            this.MazeDrawer.Draw(false, false);
            this.CurrentCell = null;

            this.panel1.BackColor = this.MazeDrawer.WallColor;
            this.labelSize.Text = string.Format("{0} x {1} maze", this.mazeHeight, this.mazeWidth);
            this.labelCells.Text = string.Format("{0} steps", this.mazeHeight * this.mazeWidth);
            this.buildCells = 0;
            this.backtrakBuildCells = 0;
            this.progressBarBuildCells.Maximum = this.mazeHeight * this.mazeWidth;
            this.progressBarBuildBacktrack.Maximum = this.buildCells;
            this.labelBuiltCells.Text = string.Format("{0} / {1} (0% / {2})", this.buildCells, this.mazeWidth * this.mazeHeight, this.buildCells - this.mazeWidth * this.mazeHeight);
            this.labelBacktrackBuiltCells.Text = string.Format("{0} / {1} (0% / {2})", this.backtrakBuildCells, this.buildCells, this.backtrakBuildCells - this.buildCells);
        }
Example #2
0
        private void buttonNew_Click(object sender, EventArgs e)
        {
            timer.Stop();
            MazeDrawer.CalculateSize(this.panel1.CreateGraphics(), (int)numericUpDownPathSize.Value, (int)numericUpDownWallSize.Value, out this.mazeWidth, out this.mazeHeight);
            this.Maze                        = new Maze(this.mazeHeight, this.mazeWidth);
            this.MazeDrawer                  = new MazeDrawer(this.panel1.CreateGraphics(), this.Maze, (int)numericUpDownPathSize.Value, (int)numericUpDownWallSize.Value);
            this.MazeDrawer.BuildColor       = this.buttonBuildColor.BackColor;
            this.MazeDrawer.BuildBackColor   = this.buttonBuildBacktrackColor.BackColor;
            this.MazeDrawer.ExploreColor     = Color.Red;
            this.MazeDrawer.ExploreBackColor = Color.Yellow;
            this.MazeDrawer.Draw(false, false);
            this.CurrentCell = null;

            this.panel1.BackColor                  = this.MazeDrawer.WallColor;
            this.labelSize.Text                    = string.Format("{0} x {1} maze", this.mazeHeight, this.mazeWidth);
            this.labelCells.Text                   = string.Format("{0} steps", this.mazeHeight * this.mazeWidth);
            this.buildCells                        = 0;
            this.backtrakBuildCells                = 0;
            this.progressBarBuildCells.Maximum     = this.mazeHeight * this.mazeWidth;
            this.progressBarBuildBacktrack.Maximum = this.buildCells;
            this.labelBuiltCells.Text              = string.Format("{0} / {1} (0% / {2})", this.buildCells, this.mazeWidth * this.mazeHeight, this.buildCells - this.mazeWidth * this.mazeHeight);
            this.labelBacktrackBuiltCells.Text     = string.Format("{0} / {1} (0% / {2})", this.backtrakBuildCells, this.buildCells, this.backtrakBuildCells - this.buildCells);
        }