top of page
Writer's pictureacebloke

First collision between balls

I have been putting off getting on with the next stage of Billiards, mostly working out some pseudo code before finally committing to lines of code. Collision between the balls is the most complex part of the game, and tests my knowledge of what I think the Channel F can handle and how I, a relatively incompetent programmer can manage.


This image shows the single situation that currently is able to be detected. A ball travelling east which is head on can hit and continue that ball on. That ball can also hit into either other ball again if it was to encounter it. This means I could hit the red ball, the red ball could hit into the blue ball, and the blue ball.


The next thing I really need to try and do is to work out the other potential hits when going in that direction, say if the ball is at an angle, and which angles each of those ball goes in. I've got this down in my pseudo code.


After that the challenge is to try to format the code in the most efficient way to avoid having to directly code for each encounter, assembly is not my strong point, so I think I can do it line by line directly, but do want to slim it down if I can, which comes with the bonus of being done quicker if correctly done.


Finally, I need to record hits in the right way. Green player needs to hit blue and red balls with the green ball, and vice versa for the blue player - that will need recording in the right way - again in pseudo code I've got that down and think it will be fairly easy.

2 views0 comments

Recent Posts

See All

Kommentare


bottom of page