Example #1
0
int main ()
{
//instantiate the simulator 
    Simulator theSimulator;
    
//load the simulator      
    theSimulator.getData("sphere.txt");
//run the simulation
    double time = 0;
    double tick = .01;
    while (time < 1)
    {
        theSimulator.updateCoords();
        theSimulator.boundaryCheck();
        theSimulator.collisionCheck();
        theSimulator.prune();
        theSimulator.updateAccels();
        theSimulator.updateVels();
        theSimulator.clockTick();
        time = time + tick;
    }
        while (time < 6)
    {
        theSimulator.updateCoords();
        theSimulator.boundaryCheck();
        theSimulator.collisionCheck();
        theSimulator.prune();
        theSimulator.updateAccels();
        theSimulator.updateVels();
        theSimulator.clockTick();
        time = time + tick;
    }
        while (time < 17)
    {
        theSimulator.updateCoords();
        theSimulator.boundaryCheck();
        theSimulator.collisionCheck();
        theSimulator.prune();
        theSimulator.updateAccels();
        theSimulator.updateVels();
        theSimulator.clockTick();
        time = time + tick;
    }
           while (theSimulator.updateCoords())
    {
        theSimulator.boundaryCheck();
        theSimulator.collisionCheck();
        theSimulator.prune();
        theSimulator.updateAccels();
        theSimulator.updateVels();
        theSimulator.clockTick();
    }
//print the report  
    theSimulator.finalReport();
    
}