views:

12

answers:

1

hi, Can anybody help me to end a simulation when there is no one inside?? that is simulation could end when the syatm gets empty regards, nilani

A: 

The easiest way to do so would be to keep track of the number of entities in your system, and check this number against 0 on every iteration.

A possible approach in an OO-language could be to derive all your entities from a common ancestor class. This should contain a static variable which is incremented in the constructor and decremented in the destructor of an entity.

sum1stolemyname