Well, I’d say it is a nice task to start learning scripting for Blender
Personally, I am interested in solving it but I dont know how much time I can devote to this right now. I usually dont read other’s related scripts cause I like MY ideas getting implemented. May be this is NOT the perfect tactics but this really leads to making scripts MY way, not developing scripts of others, ok?
Mathematically, the task is to inscribe spheres into a bigger one. So lets take it that gums are spheres with radius r and the gumbowl - with R. For 1 gum inside => you’d need to just “drop” it down. For this (and anything else) you dont need any physics engine but only make a simulation. Sooo you simply place the first gum right at the bottom of the bigger sphere. What does it mean? Suppose the gumbowl (its center) is at X,Y,Z => gum #0 should be at X,Y,(Z-r)… It’s easier then physics engine, right?
It is also know from geometry of the plane that if you have a circle there with radius r, then you can circumscribe exactly 6 such circle around the main one. It works for a sphere placed on a plane too - you may have exactly 6 such spheres around the main one - each touching the other and ALL touching the plane, right? But we have a sphere, not a plane… Your parameters are R and r… soo how many gums can be placed inside the gumbowl depends on the ratio R/r… Anyway, if you have one gum in the middle and 5 other around it in a way to touch it and ALL touching the bowl, then you will have insufficient space for the 6-th gum so the 6-th gum will be a bit higher then the others. I hope it is possible for everyone to imagine this. It is important before scripting anything to know what really happens… Sorry, I dont know a better term than “touch”, “touching” but I mean that two bodies/object have only 1 common point, ok? So far Im trying to implement location of cums preserving maximum symmetry. Just one is odd so far. And here is the first challenge - to find its proper place. It could be done under conditions discussed above + gum #6 (7-th one) should be not only touching the #5 (6-th one) but also gum #1 (the 2-nd one), ok? This implements some disorder which you need to consider further while placing another gums inside. It is also to judge whether to try reserving symmetry (order) at least on 1 side of the bowl or not.
Another strategy is to randomly place around the main gum another 5 then place other above following the conditions described above. This would be even more realistic, right? Soooo… if I had all those strategies implemented, I make at the end an interface for the user to choose what and how to do - to enter values for R and r, etc…