Hi,
I am sometimes able to fill Maw in a single T move. There were no additional cascading matches.
How is it even possible that your engineering team struggles with these simple algorithms?
I recommend the following fix:
1.) After each move perform a breadth-first search to find how many surrounding gems match.
2.) Perform a 2D weighted bin packing on a temporary 2D array with same size as the matching area in previous step.
For your 2D weighted bin packing algorithm you need 12 objects. 1x3 through 1x8 objects and 8x1 through 3x1.
On each axis your largest objects should have the least weight/cost. For example your 1x8 object lightest, your 1x7 even heavier and so forth. This ensures that the algorithm gives highest priority to the largest possible gem match.
Best Wishes,
-Dave