PDA

Click to See Complete Forum and Search --> : Code this better...


dglienna
Aug 16th, 2004, 11:45 PM
This program was developed as a brute-force method of a previous post (by me) that nobody seemed to care to try.

http://www.vbforums.com/showthread.php?s=&threadid=300549 (Posted HERE)

I need 2 things.
1) try to make it more efficient
2) find a way to make sure that a(0) thru a(9) has a different value for each array value. (Make sure that it uses 0-9) with NO duplicates

Then, it will be correct. I used a break statement to make sure that it would calculate the right answer, but it took too long!

Here is my code.

Enjoy! :D

dglienna
Aug 17th, 2004, 11:31 PM
I have concluded that it would not be of any use to waste cycles filling in a array of value-flags, except in some circumstances, like when it would save thousands of cycles. Plus, I don't know if all values are used in numbers that don't add up?

I do know that there is only one answer that computes, and also uses all of the digits. [I have checked them all]

Plus, I didn't compile it, so that I could use the break key.

Maybe I will try to see if the first 4 arrays are unique, and if so, then skip the inner loops. This would save a bunch of cycles, but I'm not sure of the most efficient AND fast way to do it is.

I will post the new code when I have it finished, so that it will stop at the correct number. Then I can compile it and time its operation as I make changes.

I wasn't sure how to go about solving the problem programmatically, and it feels good having accurate results.

:D

coreyw2000
Aug 31st, 2004, 07:23 AM
uh... where is the form?? it not included

dglienna
Aug 31st, 2004, 09:58 PM
sorry about that. here it is. I've added it to the project.

:D

haven't done anything to it, though. sorry again.

dglienna
Aug 31st, 2004, 10:01 PM
this was also discussed in detail in math forum.

Here... (http://www.vbforums.com/showthread.php?s=&threadid=300549)

It has become so common that it was hardly worth it.