How should I program a simulation of a "car" moving along a track?
For Operating Systems class I'm going to write a scheduling simulator entitled "Jurrasic Park".

The ultimate goal is for me to have a series of cars following a set path and passangers waiting in line at a set location for those cars to return to so they can be picked up and be taken on the tour. This will be a simple 2d, top-down view of the track and the cars moving along it.

While I can code this easily without having to visually display anything I'm not quite sure what the best way would be to implement a car moving along a fixed track.

To start out I'm going to simply use OpenGL to draw my cars as rectangles but I'm still a little confused about how to approach updating the cars position and ensuring it is moving along the set path for the simulated theme park.

 


Should I store vertices of the track in a list and each call to update() move the cars a step closer to the next vertice?  If anyone can conceptually come up with a design better than this I would appreciate some feedback.
How should I program a simulation of a "car" moving along a track?
===

For Operating Systems class I'm going to write a scheduling simulator entitled "Jurrasic Park".

The ultimate goal is for me to have a series of cars following a set path and passangers waiting in line at a set location for those cars to return to so they can be picked up and be taken on the tour. This will be a simple 2d, top-down view of the track and the cars moving along it.

While I can code this easily without having to visually display anything I'm not quite sure what the best way would be to implement a car moving along a fixed track.

To start out I'm going to simply use OpenGL to draw my cars as rectangles but I'm still a little confused about how to approach updating the cars position and ensuring it is moving along the set path for the simulated theme park.

 


Should I store vertices of the track in a list and each call to update() move the cars a step closer to the next vertice?  If anyone can conceptually come up with a design better than this I would appreciate some feedback.