Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
> since i'm a bit free and didn't sleep last nite.. and i can't sleep now coz it's already 5pm.. maybe i can spend some time drawing some ugly matrix boxes here :p let's play with 3x3 matrixes ~ > step 1: (empty box) > x.x.x > step 2: (1 !!!) [middle top row] > x.1.x > step 3: (2) > x.1.x > step 4: (3) > x.1.x > step 5: (4) > x.1.x > step 6: (5) > x.1.x > step 7: (6) > x.1.6 > step 8: (7) > x.1.6 > step 9: (8) > 8.1.6 > step 10: (9) > 8.1.6 How long did that take you Chin? Also, did you do that by yourself, or did you create your program and run it? If you did it by yourself and it pretty short time, that's impressive!! At least, to me it is...I know I can never seem to get that! Your pseudocode seems like it will work. The only problem I can see is that if that's all there is to the program for the actual logic of filling the matrix (not counting the part to finally check each row and column at the end), this won't work. After each iteration of the loop, the sums from each row, column will have to be tabulated and an "intelligent" suggestion should probably be sent as the next number to fill and where to fill it. Which means that there might actually be no need for your loop. Because if there is a method that "intelligently" calculates the next number and where to place it, a boolean array might have to be used to keep track of elements already filled up. There would probably also need to be a way of checking whether there is a point in continuing to fill the matrix or the matrix should be refilled (from the beginning). But even then, there would need to be some way of making sure that the program didn't take a million tries to give one answer. Replies:
|
Sponsored Links
|