There is a task: There is a block (rectangle) with boxX size on boxY . There is a field (rectangular), on which it is necessary to add these blocks. The field sizes, respectively, are fieldX and fieldY .

We assign random field sizes and random block sizes (fixed for all blocks in a particular case). It is clear that boxX * 2 < fieldX and boxY * 2 < fieldY , otherwise why add. And we get the layout (in any form, these are already minor problems) of blocks on the field. You can rotate the blocks as you like, in any order. The main thing is not to go beyond the edge of the field and not leave too large distances between the blocks. Criterion two: the number and grip * blocks.

I could not find such an adaptive algorithm, I ask for help, suddenly someone saw. Or ready to lead the discussion. Searched both in the RuNet, and on English-speaking resources. I write the algorithm myself on python, but I will accept help in any language, I will figure it out.

Separately I will ask about adaptive layout. I did not work with it, there is little knowledge of the web, but there is something. If my task is to solve AB, tell me. But, in my opinion superficial, yet different things.

* I understand by clutch here, for example, the brick luggage algorithm, when, when moving, a block construction has a lesser chance of falling apart.

    0