Simulated annealing is a programming trick for quickly packing a bunch of things together. It’s based on the idea of annealing, where (as I understand it) a metal is heated, which gives the molecules enough energy to wiggle, then cooled slowly, which lets the molecules settle into a denser arrangement.
I’ve been wondering for a while whether this could make WordCram faster. It seems well-suited to the problem – the heart of WordCram is packing non-overlapping shapes together.
So I made this Processing experiment sketch, which uses simulated annealing to arrange circles.
I think it works pretty well – it can arrange 200 circles of different sizes along a line in under a second. (My first experiment was a lot slower, which gives you an idea how powerful this trick can be – once you get it right.)


