Any ideas of how to achieve it?
Just some thoughts:
You’ve got a pyramid. 4 sides and 1 base. Sides are triangles, the base is a square.
There are 118 elements, so you need to know how to distribute them in the pyramid formation.
I’m not a mathematician, but I think that you’ll get such equation: x*x + 4 * y = 118.
In the first approximation you’ll get x = 5, y = 25, that’ll give 5 * 5 + 4 * 25 = 125 (the difference is 125 - 118 = 7, tolerable ).
So, we’ve got 25 items per side. Suppose, we need to place them in rows, usning arithmetic progression (n + 2), thus we’ll have 5 rows (1, 3, 5, 7, 9, numbers are amount of items in each row). If 1 item is 1x1, then we have a triangle with 5 units heitght and 9 units in its base.
We’ve got 4 sides, then we can put on them 100 items. The rest 18 items are for the base of the pytamid.
Use two loops to put items in the formation of triangle, using that arithmetic progression.
All that stuff is just from the scratch
It’s not that rocket science