Thread: Conway's Game of Life

  1. #31
    Registered User
    Join Date
    Sep 2012
    Posts
    23
    I don't understand what you mean by trigger, there is no such word in my instruction sheet. We have never covered anything like that in class.

    Code:
    int main() {
        char c;
        display(b1, b2);
        printf("Hi! Would you like to play the Game of Life? (y/n)");
        c = getchar();
        while (c == 'y') {
            new_board(b1, b2);
            copy_back(b1, b2);
            display(b1, b2);
            c = getchar();
             for (r = 0; 20; r++) {
                 for (c = 0; 20; c++) {
                     count = count_neighbours(r, c);
                     if (count == ) 
                         ?
        }
    }

  2. #32
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by Anhur View Post
    I don't understand what you mean by trigger, there is no such word in my instruction sheet. We have never covered anything like that in class.
    By "trigger", I mean there will be a number given. When the count of neighbors reaches that given number, or more, then the cells in the game of life, which are mostly surrounded by different neighbors, will change.

    For instance, if most of my neighboring cells become a '.' then I will become a '.' also (maybe).

    So, read up on Conway's Game of Life, or look in your class notes or assignment sheet. Because the Game of Life doesn't have just one set of rules - there are several.

    You need to learn what count is needed to cause a cell to change, AND what that change should be.

    Google is your friend, if all else fails.

    Think of it like sport - there is auto racing, but there is not just ONE kind of auto racing - there is Formula 1, there is Indy, there is stock car, there is funny car. Each has different rules, etc.

    You can't finish the program until you know the rules for your version of the game.

  3. #33
    Registered User
    Join Date
    Sep 2012
    Posts
    23
    "A live square stays alive if it has exactly two or exactly three live neighbours, otherwise it dies"
    "A dead square becomes alive if it has exactly three live neighbours, otherwise it stays dead."

  4. #34
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    What char are you using to show that a square is alive? And which one do you want to show that a square is dead? '.' and '*', are all that I see, with * being alive, is that right?

    So put those numbers into the if statement in the main game while loop, and see what you can work up.

  5. #35
    Registered User
    Join Date
    Sep 2012
    Posts
    23
    I honestly would not have a clue on how to write that. I was hoping to have this program written and working correctly by now, but seeing as it's due in a few hours, I'll just have to hand in what I have done.

  6. #36
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    I recommend you drop this class, before the deadline for dropping, has passed. Programming takes a LOT of time/study/practice. Perhaps you could take it up later, after you set it up so you have more time for it, and spent some time with some of the excellent tutorials that are on-line (including whole video classes).

    I don't make this recommendation lightly. When I saw the if statements you made up, and they were all the same, and your comment above, I knew it was not possible to succeed here, at this time.

    Perhaps another time.
    Last edited by Adak; 09-27-2012 at 04:02 AM.

  7. #37
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    I recommend you drop this class, before the deadline for dropping, has passed.
    I disagree (and I am a little shocked to hear that from the most patient advice giver on here) - This is clearly your first attempt at programming and there is only one way to learn (by doing it). You need to work harder.

    If you can't get the program working before the deadline, still hand it in - You shouldn't quit because something is hard, you should learn from it.

    After the deadline, your teaching will sit there and give you all the answers. Make sure that you can write the if statements for a problem that you visualise. Ring them up and tell them that you want to go through your program with them and get it working - Even though you won't get any marks for it any more.
    Fact - Beethoven wrote his first symphony in C

  8. #38
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    When the student says he can't learn because he's got other important stuff to do (papers), and he shows that with the lack of code in his replies - I have to accept that as the truth.

    Doesn't mean I like it, and doesn't mean he can't learn to program if he had more time to study and practice.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Text Based Conway's game of Life in C
    By spideysagnik in forum C++ Programming
    Replies: 2
    Last Post: 07-15-2011, 07:10 AM
  2. Recomposing the Conway's Game code in C
    By Noya in forum C Programming
    Replies: 8
    Last Post: 05-20-2011, 09:04 PM
  3. John Conway's Game Of Life
    By O Mighty Nips in forum C Programming
    Replies: 3
    Last Post: 05-14-2011, 11:30 PM
  4. Replies: 20
    Last Post: 05-24-2007, 01:06 AM
  5. Conway's Life
    By prxom1 in forum C Programming
    Replies: 1
    Last Post: 03-27-2002, 02:13 PM