Example #1
0
        /// <summary>
        /// Reset the problem instance.
        /// </summary>
        private void resetData()
        {
            Cities = new City[_size];
            Route  = new ArrayList(_size);
            bssf   = null;

            if (_mode == HardMode.Modes.Easy)
            {
                for (int i = 0; i < _size; i++)
                {
                    Cities[i] = new City(rnd.NextDouble(), rnd.NextDouble());
                }
            }
            else   // Medium and hard
            {
                for (int i = 0; i < _size; i++)
                {
                    Cities[i] = new City(rnd.NextDouble(), rnd.NextDouble(), rnd.NextDouble() * City.MAX_ELEVATION);
                }
            }

            HardMode mm = new HardMode(this._mode, this.rnd, Cities);

            if (_mode == HardMode.Modes.Hard)
            {
                int edgesToRemove = (int)(_size * FRACTION_OF_PATHS_TO_REMOVE);
                mm.removePaths(edgesToRemove);
            }
            City.setModeManager(mm);

            cityBrushStyle          = new SolidBrush(Color.Black);
            cityBrushStartStyle     = new SolidBrush(Color.Red);
            routePenStyle           = new Pen(Color.Blue, 1);
            routePenStyle.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
        }
Example #2
0
 private HardMode.Modes getMode()
 {
     return(HardMode.getMode(cboMode.Text));
 }
Example #3
0
 public static void setModeManager(HardMode modeManager)
 {
     City.modeManager = modeManager;
 }