|Just another Perl shrine|
Re^4: Algorithm to fit photos into spaces on pagesby SmugX (Beadle)
|on Nov 16, 2005 at 17:07 UTC||Need Help??|
I was just playing around with your first lot of code when you posted your second update! :-) This works really well, and I can definitely take this idea and run with it.
I noticed that it seemed to have a tendency to use the earlier layouts - most books seemed to often use layouts 1-6, but rarely the later layouts.
I assumed this was because the layouts were always being presented to the regex engine in the same order. Indeed, if I tweak your second example to randomise the order, it seems to use a more general spread of layouts, with the (interesting?) side effect of generating a different valid book each time.
Then I noticed that in your second example at least, the photos aren't necessarily all used. I assumed I can prepend a '^' and append a '$' to the regexp, and this seems to resolve the issue.
I'm hence left with:
Thanks for all your help, Roy. ++ your posts.