# Help With Final

• 05-07-2002
Matt123456
Help With Final
I need help on this final Project. Get me on aim at tafnam if u can help or email this to me at mrmattregan@hotmail.com

Project#11
Farmer Jack's Mushroom Farm

You have decided to go into the mushroom farming business. You have gone out and rented a warehouse and built a mushroom bed 20 feet X 20 feet. You have enough money to seed the bed with 10 plants. Each plant grows in a 1X1 area of the bed. You will let those plants grow and propagate new plants until the bed is full. New plants are only born in vacant squares. The probability of a birth in any facant square depends on the number of neighboring plants. The probabilities are as follows:

Neighbors Prob. Of Birth
-------------- -------------------
0 .05
1 .10
2 .20
3 .30
4 .40
5 .50
6 .40
7 .30
8 .25

Mushrooms are very hardy and the probability of one dying decreases as the mushrooms farm becomes more dense. The probability of a living mushroom dying is small, only 2% if there are 100 or less mush rooms, 1% if there are 101-300 mushrooms and 0% if there are more than 300.

Write a program that simulates your mushroom farm. Allow the user to enter the first 10 plants and then "grow" the mushrooms according to the rules above. All births and deaths occur at one time overnight. The farm should continue until either the whole bed is full(harvest time) or all the mushrooms die(bankruptcy). Display each successive generation of plants and tell the user what happened when the farm stops(either harvest or bankrupt).
This is what I got so far: I need this by Wednesday Night.

#include<iostream.h>
#include<iomanip.h>
#include<conio.h>

int main(void)
{
bool farm[22][22];
bool harvest,bankrupt;

init_farm(farm);

plant_farm(farm);

show_farm(farm);

getch();

do
{
grow_farm(farm);
show_farm(farm);
bankrupt=is_bankrupt(farm);
}
while(!harvest&&!bankrupt(farm);

if(harvest)
count<<"Time to harvest the mushrooms";
else
;

}

void grow_farm(bool farm[][20])
{
int i,j,mcount=0,prob,neighbors;

bool temp[22][22]

for(i=0;i<22;i++)
for(j=0;j<22;j++)
temp[i][j]=false;

for(i=0;i<22;i++)
for(j=0;j<22;j++)
{
if(farm[i][j]==true)
{
prob=rand()%100;
if(mcount<=100&&prob==0||prob==1)
farm[i][j]=false;
else if(mcount<=300&&prob==0)
farm[i][j]=false;
}
else
{
prob=rand()%100;
neighbors=farm[i-1][j-1]+farm[i-1][j+1]+farm[i][j-1]
+fram[i][j+1]+farm[i+1][j-1]+farm[i+1][j]+farm[i+1][j+1];
if(neighbors==0&&prob<5)
farm[i][j]=true;
else if(neighbors==1&&prob<10)

}
}
• 05-07-2002
napkin111
You shouldn't have said it was your final, now noone will help you...

napKIN
• 05-07-2002
InFeStEd-ArCh0n
I quite agree. We will not support your dishonesty.
• 05-07-2002
NANO
The only thing that I can say...
Good Luck in your final,

;)
• 05-07-2002
fyodor
Hmmm...It looks a bit similar to John Conway's Game of Life. Do a search for that and you'll probably get some pertinent information.
• 05-07-2002
Its not that they wont help. It's just that they dont know how to do the prog. Cause they are stupid.
• 05-07-2002
Code:

`I quite agree.`
hhahahaha...can't help myself...hahahahaha
• 05-07-2002
Traveller
Well, thats not really nice. Firstly the above posted program is pretty bare, theirs one function kindof done but thats about it. People here will not write your entire code for you, however if their is a specific question or a question as to how to develop something(aka which direction) I find that almost anyone will help. You really shouldn't say things you don't know anything about.
• 05-07-2002