LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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

Reply
 
LinkBack Search this Thread
Old 07-25-2001, 04:32 PM   #1
mandrake_linux
LQ Newbie
 
Registered: Mar 2001
Posts: 22

Rep: Reputation: 15
Smile 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 04:34 PM.
 
Old 07-25-2001, 05:06 PM   #2
isajera
Senior Member
 
Registered: Jun 2001
Location: San Antonio, TX
Distribution: distro? what's a distro?
Posts: 1,635

Rep: Reputation: 45
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.
 
Old 07-25-2001, 07:46 PM   #3
mandrake_linux
LQ Newbie
 
Registered: Mar 2001
Posts: 22

Original Poster
Rep: Reputation: 15
Smile 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 07:48 PM.
 
Old 07-27-2001, 04:03 AM   #4
isajera
Senior Member
 
Registered: Jun 2001
Location: San Antonio, TX
Distribution: distro? what's a distro?
Posts: 1,635

Rep: Reputation: 45
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the best cryptographic algorithm? Linux.tar.gz Linux - Security 19 05-02-2006 08:54 PM
Airsnort Algorithm inthefuture Linux - Security 1 08-26-2004 10:01 PM
Do you memorize the algorithm?For... shakedown1987 Programming 5 08-05-2004 07:21 AM
skiplist algorithm Tafta Programming 1 12-20-2003 01:43 PM
intelligent algorithm raven Programming 1 01-27-2002 09:27 PM


All times are GMT -5. The time now is 05:03 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration