A simple code to simulate the impact of a ball on a billiard table without friction. The process of evolution is that we place one or more balls in a point and specify the initial direction of movement for each one, and the program continues until the entire page is scrolled.
Of course, it may not be scrollable with a full-screen ball
In this program, we display directions with 1 and -1 ↓
- Move to the right (+x) : 1
- Move to the left (-x) : -1
- Move to the up (-y) : -1
- Move to the down (+y) : 1