SE450: Some advice: Start small [13/16] Previous pageContentsNext page

        
To get all the initial code working, you need to keep things simple.
Until I got all the distance to obstacle stuff correct, I would keep
things very simple:

Road1 and Road2 each have length 50 (positions 0-49)
Car1 and Car2 each have length 10
Car1 and Car2 each have maxVelocity 10
Simulation timestep is 1

Then we expect output something like this (with one car):

Time=1,  Car1 on Road1 at 0
Time=2,  Car1 on Road1 at 10
Time=3,  Car1 on Road1 at 20
Time=4,  Car1 on Road1 at 30
Time=5,  Car1 on Road1 at 40
Time=6,  Car1 on Road1 at 0
Time=7,  Car1 on Road1 at 10
Time=8,  Car1 on Road1 at 20
Time=9,  Car1 on Road1 at 30
Time=10, Car1 on Road1 at 40
Time=11, Car1 dies


Once you get that working, try putting Car2 behind Car1 and see if you
can get it to compute its velocity correctly.        

Previous pageContentsNext page