public WalkEnviornment(EnviornmentMap map) { this.map = map; InitializeComponent(map.Size); mapDisplay.Map = map; walker = new RandomWalker(map, this); walker.InitiateRandomWalk(new Vector(map.Size.Width / 2, map.Size.Height / 2)); }
private void Reset_Click(object sender, EventArgs e) { this.map = new ObstructionRenderer(new MapObstructionProperties()).Map; InitializeComponent(map.Size); mapDisplay.Map = map; walker = new RandomWalker(map, this); walker.InitiateRandomWalk(new Vector(map.Size.Width / 2, map.Size.Height / 2)); }
public ObstructionRenderer(MapObstructionProperties properties) { List<Vector> centerPoints = new List<Vector>(); Random random = new Random(); for (int i = 0; i < properties.NumberOfObstructions; i++) { int xPos = random.Next(properties.Width); int yPos = random.Next(properties.Height); centerPoints.Add(new Vector(xPos, yPos)); } foreach (Vector p in centerPoints) { int angleOfExtension = random.Next(0, 360); int axis1 = random.Next(properties.axisMin, properties.axisMax); int axis2 = random.Next(properties.axisMin, properties.axisMax); allObstructions.Add(new Ellipse(p, axis1 / 2, axis2 / 2)); } Map = new EnviornmentMap(allObstructions, new Location(properties.Width, properties.Height)); }
public RandomWalker(EnviornmentMap map, Form form) { testBitmap = new Bitmap(map.Size.Width, map.Size.Height); g = Graphics.FromImage(testBitmap); boardBounds = new Rectangle(0,0,map.Size.Width,map.Size.Height); obstructions = map.Obstructions; }