Motifs (M): Number of different symbols, usually unique pictures.
Exceptions are Mahjong’s Flower and Season motifs, both having multiple (4) variations (Plum blossom, Orchid, Chrysanthemum, Bamboo / Spring, Summer, Autumn, Winter), basically for artistic reasons and to increase the tile number.
Pairs (P): Number of pairs per motif.
Obviously at least 1 pair is mandatory for such pile reduction games (like in Memory), and Mahjong features 2 pairs. This number could also be higher to make the game easier.
Cubes (N): A tower’s total number of cubes.
Width (K): A tower’s side length in cubes.
Although rectangular or arbitrary base shapes are possible, for symmetry (and algorithmic simplicity) it’s always square in our case.
Height: A tower’s height in cubes.
Note that the topmost plane may be filled only partially, depending on divisibility (by Width²) of the total number of cubes.
Size: A tower’s bounding box.
We support a max. width of 8, and a max. height of 16, resulting in a max. number of 1024 (8×8×16) cubes.
Score: During runtime players get 1 point per pair removal.
Clearance yields a bonus for motivation. These extra points are calculated individually, depending on difficulty. Apparently gameplay is the harder (more tedious) the more motifs, and the easier the more pairs, making Motifs and Pairs opposing factors: M / P.
Given our default theme Mahjong (with M=36 and P=2), we get 18 (36/2) here, but that’d be too tiny a bonus - compared to the 72 points (1 per pair) already scored at this point. Let’s set it to a motivating 144 to also reflect the total tile number, which can be done by a factor of 8 (8×18=144). Since the value of Pairs could be odd, leading to decimal places, we apply a rounding step and get the formula:
bonus = round(8 × M / P)