As promised P2 Ze Code!
Well actually before the code comes the pencil and paper. I got some sound advice a while back to `understand the problem’ before starting anything. Work it out and then execute the solution. Easier said than done in some cases but definitely a muscle that should be exercised!
Here’s a look at my some of my crappy scratch pad looking at the problem;
Okay now my execute function:
Note: This was more a proof of concept for me, which mean I haven’t really considered threading issues etc etc pretty sure this needs tweaking for threading but that aside;