Here a asteroids(game) like simulation. It has a save and load state. It has ai that lets the ship move into a random direction without hitting a asteroid. It saves the state and gives the ship a random angle and thrust value and simulates a x number of steps into the future. If there is no collision then these values are passed into the regular visible onscreen version before(restored) the simulation occured.
Forward collision