5 minutes
Trick Shots
Trick shots live after the first hit. A kick shot bounces the cue ball off a rail before it reaches a ball. In a combination, your ball knocks one ball into another. In a carom, the cue ball glances off one ball into the next. The ghost ball can't show any of that.
The whole shot
To see a whole shot, move every ball. Copy the table, strike the copy, and run the table's own step on it until all sixteen balls stop. Keep a line of where each ball went. simulateShot does that with stepTable, the same function play runs, the same 1/120 s step and the same ball order: by number, as the table sorts them. So the forecast lands where the real balls land, to nine decimal places in BilliardTable's tests. One difference: in play a scratched cue ball comes straight back on the head spot, while the forecast just ends its line in the pocket.
Every step, a ball that reaches a pocket is out, and its line ends there. A ball still moving gets a new point every 1.5 cm. When nothing moves, the run is over. Here is a full-power break:
Continue reading
Unlock the Full Course
Every lesson, the runnable examples, and the finished build — yours to keep.