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:
> Now if you can post a really interesting homework assignment that will teach me something new as I write it, then maybe I'll write it (but you'll have to also tell me the due date, so I can post it the day after). Which reminds me, Chin, I came up with a pretty cool variation of that "draw the diamond" homework from a while back. I'll post it some time later (here's a teaser: it takes a command-line parameter specifying which grade you'd like on the project and uses a different algorithm for each grade from F to A+ (yes, I had too much time on my hands)). > - Chet hey! that's cool! :p u can pass the codes here so that we can play around with it ;) i'm a bit busy with new incoming "potential" application projects rite now but i sure can find time to have some fun ^_^ Chet, remember a while back somebody asked for the algorithm of a odd-numbered n x n matrix squares which has the numbers of 1 to (n x n) inside each square which all sums up to the same total (horizontally, vertically, and if i'm not mistaken, diagonally too). well, when i was young i really loved to play with that algorithm, and i was seriously tempted to post the answer.. but well, guilt held me back :p. he gotta do his own assignment ;) anyway, that's a pretty interesting algorithm.. i didn't exactly tried (i was still pretty young at that time) to figure out the formula/algorithm.. but it follows certain rules. #assuming left-bottom most square is (0,0) and coord <=> (i,j) 1. i don't know why but i always start with the top row of the matrix, in the middle. place "1" there. ((int)(i_max/2)+1),j_max) 2. head north-east. (i+1,j+1) for(int NUMBER=2;NUMBER<=nxn;NUMBER++) Replies:
|
Sponsored Links
|