Hi guys,
I’m here to ask every dynamo user for any ideas about my work.
I’m trying to place tetris blocks on a quad grid surface by dynamo.
They would be placed in sequence (one by one) and optimized.
Here, “optimized” means “minimized empty space”, “filled with the maximum area”.
I’ll explain about the process that I thought.
I have these model lines.
- Tetris blocks(green line)
- A square(black line) where tetris blocks will be placed.
Step 1. Divide Surface by quad grid
First, import the square lines in dynamo and make a surface.
Then, divide the surface by quad grid like the picture. The quad grid size is the same as 1 tetris block cell size.
Step 2. Place Tetris block in sequence
Import the tetris block lines in dynamo and make surfaces.
Then, place 1 of the blocks (randomly selected) on the grid. They can be rotated(0, 90, 180, 270 degrees).
Repeat this process until any tetris block can’t go in any more.
Expected Result
I want to optimize tetris block placement.
The result is expected to fill the maximum area and minimize the number of empty cells.
I have problems with Step 2 - how can I place the random block on the best location?
Does anyone have ideas about Step 2 placement?
It’s okay with anything - thoughts, logic, or helpful nodes.
Any ideas are welcome.
Thank you
- Here, I upload my test rvt and dyn file, too!
place_tetris_test.zip - Google Drive