Enjoy a laugh at my expense (Coding mischief)
I'm writing a sim that currently builds families and ages the members, has them intermarry and reproduce. Here's the main method of the simulation:
Code:
static public void runTick()
{
Events.Add(Sim.numTicks + ": System population is " + Characters.Count + ".\n");
int i = 0;
Character c = Characters[i];
while (c != null)
{
try
{
if (c.runTick())
{
c = Characters[++i];
}
else
{
c = Characters[i];
}
}
catch (Exception e)
{
break;
}
}
Sim.numTicks++;
}
For those of you new to programming: NEVER do this. It's a terrible practice. I just did it to hack a way through modifying an Enumerable while I'm iterating through it.