Thread: Help With Final

  1. #1
    Matt123456
    Guest

    Exclamation 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 [email protected]

    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);
    harvest=ready_harvest(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)

    }
    }

  2. #2
    napKINfolk.com napkin111's Avatar
    Join Date
    Apr 2002
    Posts
    310
    You shouldn't have said it was your final, now noone will help you...


    napKIN

  3. #3
    I quite agree. We will not support your dishonesty.
    -Mike
    {InFeStEd-ArCh0n}

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    249

    Unhappy The only thing that I can say...

    Good Luck in your final,

    C++
    The best

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    200
    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.
    I go to encounter for the millionth time the reality of experience and to forge in the smithy of my soul the uncreated conscience of my race.

    Windows XP consists of 32 bit extensions and a graphical shell for a 16 bit patch to an 8 bit operating system originally coded for a 4 bit microprocessor, written by a 2 bit company, that can't stand 1 bit of competition.

  6. #6
    Brad0
    Guest
    Its not that they wont help. It's just that they dont know how to do the prog. Cause they are stupid.

  7. #7
    Registered User DeadArchDown's Avatar
    Join Date
    Apr 2002
    Posts
    28
    Code:
    I quite agree.
    hhahahaha...can't help myself...hahahahaha
    -------------------
    "Exception"

  8. #8
    Registered User
    Join Date
    May 2002
    Posts
    317
    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.

  9. #9
    Registered User DeadArchDown's Avatar
    Join Date
    Apr 2002
    Posts
    28
    Hahahahaha....your a funny guy. I wasn't laughing at his opinion. I couldn't care less about the dope with the final...hahaha...I was laughing at "I quite agree."...hahaha...me too old chap..me too old chap.
    -------------------
    "Exception"

  10. #10
    Registered User
    Join Date
    May 2002
    Posts
    317
    Sorry, DeadArchDown. My response was to Brad0, we must have been typing them at the same time.

  11. #11
    Matt123456
    Guest

    Exclamation

    Well, this is where we ask for help isn't it? damn......

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DirectX dll Final Debug and Final Retail
    By hdragon in forum Tech Board
    Replies: 0
    Last Post: 11-15-2005, 09:46 PM
  2. Final Exams Help
    By DeepFyre in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 01-15-2005, 06:16 PM
  3. Final Fantasy I
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 03-28-2004, 11:53 PM
  4. reviewing for final exam, need help with this question
    By jlmac2001 in forum C++ Programming
    Replies: 12
    Last Post: 11-26-2003, 08:37 AM
  5. Final year project
    By khpuce in forum A Brief History of Cprogramming.com
    Replies: 22
    Last Post: 10-10-2003, 07:04 AM