A pool table ball collision simulator written in Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
system_test_inputs
ball.py
ball_test.py
constants.py
input.txt
poolTableSim.py
readme.md

readme.md

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.