Re: SOLVING A CUBE
- To: mathgroup at smc.vnet.net
- Subject: [mg48886] Re: SOLVING A CUBE
- From: "Stergios J. Papadakis" <stergios.papadakis at jhuapl.edu>
- Date: Tue, 22 Jun 2004 05:31:28 -0400 (EDT)
- Organization: Johns Hopkins University Applied Physics Lab, Laurel, MD, USA
- References: <cap4b6$cf9$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
My apologies, I assumed first that you couldn't rotate the pieces. I guess you would not have asked if that were the case. Do it recursively. Write a routine that calculates how many will fit as per my previous post (IntegerPart[L/l]*IntegerPart[W/w]*IntegerPart[H/h]), but do it for all three possible orientations of the little pieces relative to the big piece. Then figure out what is left for each of the orientations and keep the one with the least volume left over. Recursively call the routine again using that remaining volume, with a 0 result being what trips you out of the recursion. Stergios