A better method is to convert the table into a coordinate system.
Give each ball a location.
In your simulation, just query each ball's location.
_I_ would create a ball class that has properties of the ball,
such as magnitude and velocity as well as current position.
Add some methods for calculating the next position as well
as some methods for bouncing off of the rectangle and
intersecting with other balls.
Let your simulation work in chunks of time, dt (the difference in
time or lenght of a chunk). Add methods to the ball to calculate
its next or current position based on dt. The main loop would
call this method for each ball. You could also add some display
methods too, which would erase their old position and draw themself
at the new position.
In summary, I believe the simulation will be easier if you
think in terms of time chunks. Think of what needs to be performed
during one slice or chunk of time. Think not of trying to figure
out how to perform a window or subscript of the big picture.
C++ newsgroup welcome message:
C++ Faq: http://www.yqcomputer.com/
C Faq: http://www.yqcomputer.com/
-- C++ STL Library book