This is a project that attempts to find the most optimal way to pack a given number of squares. The large red square is the smallest square that the other squares all fit in, and the red dot is the center of that square. When a square is attempting to find a new position, it will turn red, although sometimes the screen will refresh after the square has already found a new position, and you won't see it turn red. Each square goes to a random position and tries to rotate to fit itself in that position. The "R checks" variable determines how many rotational checks a square will do per location. 90 will make it rotate by 1 degree at a time, and 30 will make it rotate by 3 degrees at a time. "All at once?" at 0 will make the squares will take turns moving. Having it a 1 will make them move all at once. The "Checks per turn" will determine how many different locations a square tries to go to on its turn, when "All at once" is 0.
I accidentally completely broke it but I fixed it again... I hope. Two seconds later I broke it again and now I think it is good. This is super inefficient, and won't get to a very good solution a lot of the time. I will probably keep optimizing it in the future. If you have any tips, comment them! Some possible future updates include: ~Always centering the squares in the middle of the screen ~Using math, not scratch's "touching ()" block to determine if a square overlaps with another square ~Optimizing the first guess of where the square goes