473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

need idea/algorithm

Hi all,
I have a programming problem and am not sure what's the best way to come to
a solution.

Problem:
I want to know how many blocks fit into a box. The blocks are all the same
size, but are not cubes. So you can put them upstraight or lay down. Or
start a layer upstraight and then a layer layed down. Any number of
possibilities.

Does anyone have a good idea on attacking this problem?

There are only 6 ways to turn a block, so maybe some recursive routine is a
possibility.

Another problem is how to store and show the solution, but that is of later
concern.

Thanks in advance

Frank

Nov 21 '05 #1
3 1568
Well,

I have a similar type of question being asked of me, but haven't started to
work on it.

My am leaning toward using cubic addition to determine how many blocks will
fit in the box, but that is not good enough as length and width need to be
considered.

Now as far as how to present the finished solution. That sounds like a job
for GDI+ or some 3D engine to display the final render.

Best of luck,

Chris

"Frank" <fr***@frank.com> wrote in message
news:ck**********@news5.zwoll1.ov.home.nl...
Hi all,
I have a programming problem and am not sure what's the best way to come to a solution.

Problem:
I want to know how many blocks fit into a box. The blocks are all the same
size, but are not cubes. So you can put them upstraight or lay down. Or
start a layer upstraight and then a layer layed down. Any number of
possibilities.

Does anyone have a good idea on attacking this problem?

There are only 6 ways to turn a block, so maybe some recursive routine is a possibility.

Another problem is how to store and show the solution, but that is of later concern.

Thanks in advance

Frank

Nov 21 '05 #2
Hi Frank

This is generically known as the 'knapsack problem'. If you search (Google)
on that and 'algorithm' you may find some useful links.

HTH

Charles
"Frank" <fr***@frank.com> wrote in message
news:ck**********@news5.zwoll1.ov.home.nl...
Hi all,
I have a programming problem and am not sure what's the best way to come
to
a solution.

Problem:
I want to know how many blocks fit into a box. The blocks are all the same
size, but are not cubes. So you can put them upstraight or lay down. Or
start a layer upstraight and then a layer layed down. Any number of
possibilities.

Does anyone have a good idea on attacking this problem?

There are only 6 ways to turn a block, so maybe some recursive routine is
a
possibility.

Another problem is how to store and show the solution, but that is of
later
concern.

Thanks in advance

Frank

Nov 21 '05 #3
Thanks, I knew there must be a name for it. Now I know what to search for.
Frank

"Charles Law" <bl***@nowhere.com> wrote in message
news:OK**************@TK2MSFTNGP10.phx.gbl...
Hi Frank

This is generically known as the 'knapsack problem'. If you search (Google) on that and 'algorithm' you may find some useful links.

HTH

Charles
"Frank" <fr***@frank.com> wrote in message
news:ck**********@news5.zwoll1.ov.home.nl...
Hi all,
I have a programming problem and am not sure what's the best way to come
to
a solution.

Problem:
I want to know how many blocks fit into a box. The blocks are all the same size, but are not cubes. So you can put them upstraight or lay down. Or
start a layer upstraight and then a layer layed down. Any number of
possibilities.

Does anyone have a good idea on attacking this problem?

There are only 6 ways to turn a block, so maybe some recursive routine is a
possibility.

Another problem is how to store and show the solution, but that is of
later
concern.

Thanks in advance

Frank


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Joh | last post by:
hello, here is my trouble, i would to like to write a program which could help me to detect sequence of consecutive words in list in a very efficient way. (i need to do it upon large amount of...
3
by: Gunnar | last post by:
Hello. Problem: How can I select K random values from the elements 0,1,2,3,4...,N-1 ? I don't know if there's an easy way of doing this, but here are suggestions for doing it. One way is...
10
by: Nemok | last post by:
Hi, I am trying to write an additive encryption algorithm in C++ that will encrypt a text by adding a random numer to each character in a string. The code looks similar to this: for(int...
40
by: apprentice | last post by:
Hello, I'm writing an class library that I imagine people from different countries might be interested in using, so I'm considering what needs to be provided to support foreign languages,...
1
by: Charles | last post by:
Hi all, I need C# code for Implementing MD5 Algorithm.. Hope all would have heard of MD5 Algorith... Does any one have the C# coding for that Algorithm.. please Send... ITs URgent..... Thanks...
6
by: StephQ | last post by:
I need to implement an algorithm that takes as input a container and write some output in another container. The containers involved are usually vectors, but I would like not to rule out the...
0
by: chrisotreh | last post by:
hi everyone, i need a simple code of IDA* algorithm. this algorithm is a method of heuristic search.this algorithm is the result of enhancement of Depth First Search combined with A* algorithm.. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.