Billiard Ball Simulator
Challenge: Write a program in an object-oriented or procedural language of your choice that simulates the motion of billiard balls. Specify the dimensions of the table, the positions of the billiard balls, and the velocity (speed and direction) of the balls in a text-based input file. Output the final resting position of the balls and their velocities using the same format, where all velocities are 0. Assume that all collisions are perfectly elastic so that energy losses and "spin" during collisions can be ignored.
Assume that there is a drag (deceleration) on the balls proportional to their speed. Assume the speed of a ball is zero when it becomes very small. Note that momentum (p=mv) and kinetic energy (E=1/2 mv2) are both conserved during collisions.