By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
 446,193 Members | 826 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,193 IT Pros & Developers. It's quick & easy.

# Multidimension Using Arrays

 P: 22 I Have Been Going On With This Problem I Just Cannot Do It: U Have To A Program Of The Genetis Law For Survival,birth,death. The Game Will Be Played On A Board That Consists Of 25 Squares In The Horizontal And Vertical.each Square Can Be Empty Or Contain X(presence Of Organisms).each Square Has Eight Neighbours. Birth=>an Organism Will Be Born In Each Empty Location That Has Three Neighbours Death=>an Organism Has Four Or More Neighbours And Will Die Due To Overcrowding And An Organism With Fewer Than Two Neighbours Will Also Die Due To Loneliness Survival=>an Organism With 2 0r 3 Neighbours Will Survive To The Next Generation Mar 23 '07 #1
Share this Question
2 Replies

 100+ P: 1,806 Unfortunately, you will not find homework solutions here, although we may be able to help you through some of the difficulty. To get help you will need to show that you have made some sort of effort, or be able to describe the exact trouble you are having getting started, so that we can best address your problem. You may like to speak to the teacher that gave you the assignment (after all they must know what they expect, and I'm sure they would be more than happy to assist with any difficulty) The problem sounds very similar to something called "The Game of Life" (which you might like to look up on the net, because it may give you some ideas) Good Luck with your assignment, and feel free to post again, but please understand we can't know your problem based on the assignment description. Mar 23 '07 #2

 P: 22 Unfortunately, you will not find homework solutions here, although we may be able to help you through some of the difficulty. To get help you will need to show that you have made some sort of effort, or be able to describe the exact trouble you are having getting started, so that we can best address your problem. You may like to speak to the teacher that gave you the assignment (after all they must know what they expect, and I'm sure they would be more than happy to assist with any difficulty) The problem sounds very similar to something called "The Game of Life" (which you might like to look up on the net, because it may give you some ideas) Good Luck with your assignment, and feel free to post again, but please understand we can't know your problem based on the assignment description. I HAVE MADE SOME EFFORT TO GET STARTED BUT STILL IT SEEMS AS IF I AM NOT GOIN ANYWAY HERE IS WHAT I HAVE DONE SO FAR Expand|Select|Wrap|Line Numbers #include   #include #define MAX 25 #define ORGANISMS x #define NO_ORGANISMS ' '     int birth(int life[][MAX],int x,int ' '); int  survival(int life[][MAX],int x,int ' '); int  death(int life[][MAX],int x,int ' ');     int main( void )     {     printf("enter the generation which you want,\n");     scanf("%d"); int birth(int life[][MAX])     {     int i,j;     randomize ();     for (i=0;i <=MAX;i++);         for (j=0;j <=MAX;j++);         {life[i]=rand()%100 / 2;             }     if (life[i][j]==x && life[i][j+1]==' ' && life[i+1][j]== x && life[i][j-1]== ' ' &&life[i-1][j]== x);     return 0;     };   int  survival(int life[][MAX])   {    int i,j; for (i=0;i >=MAX;i++);         for (j=0;j >=MAX;j++);             if( life[i][j]== x){                 life[i][j]=rand()%100 / 2;             }           if (life[i][j]==x && life[i][j+1]==' ' && life[i+1][j]== x && life[i][j-1]== ' ' &&life[i-1][j]== x);                 return 0;     }     int death(int life[][MAX]) { int i,j;     for(i=0;i<=MAX;i++)         for(j=0;j<=MAX;j++)             if(life[i][j]==x && life[i][j+1]==' ' && life[i+1][j]== x && life[i][j-1]== ' ' &&life[i-1][j]== x);                 return 0;         } Mar 24 '07 #3

### Post your reply

Sign in to post your reply or Sign up for a free account.