Jim Scott's Packing Algorithm in C++ and SFML
I recently stumbled across a fun little programming problem called the 2D bin packing problem (a subset of the larger Packing Problem). Basically the idea is that you have a rectangular 2D "bin" in which you can store smaller rectangles. The programmer's job is to fit those smaller rectangles into the larger rectangles in the most efficient way possible.
Quite a bit of work has been done on the subject (as evident by the Wikipedia page about the packing problem). One approach I really like is Jim Scott's algorithm. It uses a binary tree structure to keep track of open spots to put incoming rectangles. He doesn't provide any working code for the algorithm (his description is in pseudocode).
Say... you wanna try it out? First, you'll need to download and install the Microsoft Visual C++ 2010 Redistributable Package (download link). After you have that installed, all you need to do is download and extract the program itself.
Click the link below to download the .zip file containing the program.
I have set up a GitHub repository for the code, if you're interested. If you don't want to bother with the source code, take a look at a screenshot below: