>Danny: I do not understand your algorithm - could you shed some more (high-level) light on what it is doing?
Sure. The idea is that the optimal size will always be an exact fraction of either the width or the height. So what we do is drop down by multiples of these until we get to the first size that will contain N or more squares. At any particular width, we keep track of the two 'next-smallest' widths and drop down to the largest of these. Run through the algorithm with a few sample numbers and it should make sense. It may be that there's a more algebraic approach. The problem is, though, that there is no simple relationship between floor(x), floor(y) and floor(xy), which would be needed to come up with any truly useful solution. In the end, it turns into quite a complex optimisation problem, and given that the brute force algorithm is actually pretty fast, it hardly seems worth the effort :) Danny _______________________________________________ [email protected] To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com

