/// <summary> /// simulate one ant farm, return true (continue) unless max cube count has been reached /// </summary> private bool Run1() { var s = new Descriptives(); // departure time statistics for this cube var cube = new Cube(m_nAnts, this); for (int t = 0; t < m_nMaxTime; ++t) { int escaped = cube.Step(); s.AddSample(t + 1, escaped); // if escaped on step 0, it's at time 1. if (cube.Empty) break; } double completed; lock (m_summarystats) { completed = m_summarystats.Mass(); if (completed < m_nCubes) m_summarystats.AddSample(s.Mean()); } if (completed+1 == m_nCubes && m_OnCompletion != null) m_OnCompletion(m_summarystats); return completed+1 < m_nCubes; }
public void StepTest() { var j = new Job(1000, 1, 100, null); var c = new Cube(1000, j); Assert.AreEqual(c.Step(), 0); Assert.AreEqual(c.Step(), 0); Assert.IsTrue(c.Step() > 100); }