The flow of execution for this program is (will be):
- Create any number of users and add them to the simulation.
- Advance the simulation any number of ticks.
- Poll the simulation for results when desired.
- Close the simulation.
So, for the Simulation class, I need to be able to do four things:
- Accept users data objects.
- Advance the simulation by ticks.
- Poll the simulation for results.
I'm going to start with the tick method. I'll start with a simple test:
$test = new Simulation
if ($test.ticksNumber() -ne 0) { "FAIL: Should be 0 ticks." }
$test.tick()
if ($test.ticksNumber() -ne 1) { "FAIL: Should be 0 ticks." }
Of course, this uses some new testing code I just added:
#if DEBUG
// TESTING CODE
public int queueSize()
{
return computerQueue.Count;
}
public int ticksNumber()
{
return simTick;
}
#endif
And what else?
Side Task: There are three states that a dataUser can be in: Waiting, Sitting, and Done. I had used a boolean to capture the difference between waiting and sitting, but I'd need to add another and I don't want to.
Instead, I made it into an enum. It was pretty straightforward.
But that is all I have time for today.
No comments:
Post a Comment