Visit the LQ Articles and Editorials section
 Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read
 LinuxQuestions.org assistance with an algorithm
 Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game.

Notices

 07-25-2001, 05:32 PM #1 mandrake_linux LQ Newbie   Registered: Mar 2001 Posts: 22 Rep: assistance with an algorithm hello, I'm having trouble developing an algorithm that uses a sequence (1-5) and fills in a 5 x 5 rectangle. Here I'll show you the map. Any help is appreciated. I'll return the favor somehow, thanks. Here's my email bobnhim@yahoo.com Map: 1 2 3 4 5 5 1 2 3 4 4 5 1 2 3 3 4 5 1 2 2 3 4 5 1 Last edited by mandrake_linux; 07-25-2001 at 05:34 PM.
 07-25-2001, 06:06 PM #2 isajera Senior Member   Registered: Jun 2001 Location: San Antonio, TX Distribution: distro? what's a distro? Posts: 1,635 Rep: numberarray[5][5] for (i=0; i<5; i++) for (j=0; j<5; j++){ numberarray[(j+i)%5][(j+i)%5] = i+1; } let me know if this works - i'm not at my box where i can test it.
 07-25-2001, 08:46 PM #3 mandrake_linux LQ Newbie   Registered: Mar 2001 Posts: 22 Original Poster Rep: thanks Thank you for your help. Well it's not supposed to show the numbers, but pictures. Like a quilt. Sorry I did not mention that part each one of the numbers symbolizes a block of color. 1 is yellow 2 is red 3 is blue 4 is green 5 is orange Once again sorry. Last edited by mandrake_linux; 07-25-2001 at 08:48 PM.
 07-27-2001, 05:03 AM #4 isajera Senior Member   Registered: Jun 2001 Location: San Antonio, TX Distribution: distro? what's a distro? Posts: 1,635 Rep: i don't see that it makes it any different... just have each number represent a color... if(num ==1) then printf("green") or drawpicture(green)... or whatever you may need to do.