private void DestroyAll() { leaveTrailToolStripMenuItem.Checked = false; leaveTrail = false; timer1.Enabled = false; Cosmos.isRunning = false; eStringRunning = false; listView1.Visible = false; sBC = null; world = null; }
private void initializeToolStripMenuItem2_Click(object sender, EventArgs e) { if (!drawingSurfaceInitialized) { InitializeDrawingSurface(); } DestroyAll(); listView1.Items.Clear(); DestroyAll(); listView1.Visible = true; CS = CurrentSimulation.Ants; world = new Cosmos(int.Parse(textBoxFood.Text), int.Parse(textBoxNo.Text), mainPanel.ClientSize, g, listView1, mainPanel, grafx); world.Step(); }
double x, y; //ant location #endregion Fields #region Constructors //used in land mines case public Ants(Size ClientSize, Cosmos MyWorld, Array weights, int AntNumber) { clientSize = ClientSize; myWorld = MyWorld; x = Cosmos.randomR.Next(clientSize.Width); y = Cosmos.randomR.Next(clientSize.Height); dir = (float)(Cosmos.randomR.NextDouble()); net = new Network(4, 1, 6, 2); //initialize network and weights if (weights != null) this.net.Weights = weights; antNumber = AntNumber; startPosition = new PointF((float)x, (float)y); finishPosition = startPosition; }
private PointF startPosition, finishPosition; //used to find the distance traveled. so that we can make a choice //used in land mines case public Ants(Size ClientSize, Cosmos MyWorld, Array weights, int AntNumber) { clientSize = ClientSize; myWorld = MyWorld; x = Cosmos.randomR.Next(clientSize.Width); y = Cosmos.randomR.Next(clientSize.Height); dir = (float)(Cosmos.randomR.NextDouble()); net = new Network(4, 1, 6, 2); //initialize network and weights if (weights != null) { this.net.Weights = weights; } antNumber = AntNumber; startPosition = new PointF((float)x, (float)y); finishPosition = startPosition; }
private void initializeToolStripMenuItem2_Click(object sender, EventArgs e) { if (!drawingSurfaceInitialized) { InitializeDrawingSurface(); } DestroyAll(); listView1.Items.Clear(); DestroyAll(); listView1.Visible = true; CS = CurrentSimulation.Ants; string[] lines = System.IO.File.ReadAllLines("C:\\Users\\kogunlana\\AI Life\\AI Life\\lecture.txt"); world = new Cosmos(int.Parse(textBoxNo.Text), mainPanel.ClientSize, g, listView1, mainPanel, grafx, lines); Start(); //timer1.Enabled = true; //world.Step(); }
public Ants(Size ClientSize, Cosmos MyWorld, Array weights, int AntNumber) { myFoodCollected = new int[MyWorld.getNumGoals()]; invisible = false; clientSize = ClientSize; myWorld = MyWorld; x = Cosmos.randomR.Next(clientSize.Width); y = Cosmos.randomR.Next(clientSize.Height); angle = 0; // kola 2/26 add angle for obstacle avoidance dir = (float)(Cosmos.randomR.NextDouble()); net = new Network(4, 1, 6, 2); //initialize network and weights if (weights != null) { this.net.Weights = weights; } antNumber = AntNumber; startPosition = new PointF((float)x, (float)y); finishPosition = startPosition; }
private void initializeToolStripMenuItem2_Click(object sender, EventArgs e) { if (!drawingSurfaceInitialized) InitializeDrawingSurface(); DestroyAll(); listView1.Items.Clear(); DestroyAll(); listView1.Visible = true; CS = CurrentSimulation.Ants; world = new Cosmos(int.Parse(textBoxFood.Text), int.Parse(textBoxNo.Text), mainPanel.ClientSize, g, listView1, mainPanel, grafx); world.Step(); }