>>107525348
I don't know what the "legit" answer is but I didn't do it that way and got a pseudo algorithm. If you want a "real" algorithm look up NFP and Irregular 2D Packing. After a bunch of research I decided it was too much work so tried a naive solution and got it.
I ended up editing my input data after noticing some patterns. My starting shapes were:
0: 1: 2: 3: 4: 5:
### ##. ### ### ### ..#
### .## ..# .#. ##. .##
..# ### ### ### #.. ##.
(these blocks might be fucked, kind of guessed the spacing, but you get the idea)
Noticing that some of the shapes fit together nicely I created some new shapes:
0,1: 2,2: 3,3: 4,5:
### .### .#.# ####
### #### .### ####
### #### #### .###
.## ###. ###.
### #.#.
where the new shapes are combinations of the base shapes. These ones tend to be more efficient for packing, so then it's just a matter of counting each shape as incrementing the base shapes one each (or twice in the case of 2,2 and 3,3). My packing algorithm was dead simple, just pick the top left spot in the grid that it can be placed, weighted top over left. In terms of what shapes, it prioritized by absolute bounding box first (something I picked up from reading a paper about 2d packing) and places as many as it can/needs to then just moves down. It takes about ~2 seconds to run but I'm proud of my spaghetti nonetheless. NFP would have involved figuring out the optimal spot for each shape in each iteration so I just opted to brute force the location by iterating location per location until an open spot was found. As it turns out, rotations are completely irrelevant when you do it this way, I made some code to calculate rotations and never even used it - rotating the shapes to create the new more efficient ones was all that was necessary. Any stragglers not picked up by a multi shape ended up just getting placed without rotation or thought and it still worked.