Thread: i have no clue what to do..i give up.can you help me?

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    4

    i have no clue what to do..i give up.can you help me?

    I'm having problems setting up the grid for this problem and i'm not really sure if it's completely correct..So could you please help me out where you can..

    Here's the question:

    WRITE A PROGAM TO STIMULATE THE “GAME OF LIFE”. THERE IS A CITY THAT IS LAID OUT AS A GRID. EACH CELL IN THE GRID CAN BE EITHER ALIVE OR DEAD. EACHCELL HAS A MAXIMUM OF EIGHT NEIGHBOURS, WHICH ARE THE CELLS ADJACENT TO IT IN THE GRID. IF A CELL HAS MORE THAN FOUR NEIGHBOURS, IT WILL DIE OF OVERCROWDING IN THE GENERATION. IF IT HAS LESS THAN THREE NEIGHBOURS IT WILL ALSO DIE IN THE NEXT GENERATION FROM LONELINESS, OTHERWISE THE CELL LIVES IN THE NEXT GENERATION. THE GRID HAS NO BOUNDARIES, SO IF YOU ARE AT THE LAST CELL OF THE RIGHT EDGE OF THE GRID AND MOVE ONE CELL TO THE RIGHT, YOU WILL BE IN THE FIRST OF THE LEFT EDGE OF THE GRID AND VICE VERSA. IF YOU ARE THE LAST CELL AT THE BOTTOM OF THE GRID AND MOVE DOWN ONE CELL, YOU WILL BE AT THE FIRST CELL AT THE TOP OF THE GRID AND VICE VERSA. THE PROGRAM SHOULD RANDOMLY POPULATE A 50*50 GRID WITH LIVING CELLS, DISPLAY THE GRID ON THE SCREEN AND SHOULD ITERATE THROUGH 1000 GENERATIONS. AFTER EACH GENERATION THE NEW GRID IS DISPLAYED ON THE SCREEN.

  2. #2
    Registered User
    Join Date
    Mar 2007
    Posts
    4
    I have two different codes for the problem but i got them checked and found out they're wrong.So i don't know what else to try.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    http://www.catb.org/~esr/faqs/smart-...html#writewell

    One thread of shouting is quite enough.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Give me some opinions on setting up a server
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 04-19-2004, 10:38 AM
  2. Can you give me your tip plz :)
    By dionys in forum C Programming
    Replies: 6
    Last Post: 04-11-2004, 11:14 PM
  3. Replies: 1
    Last Post: 10-01-2001, 10:39 AM
  4. How To Give A Font Colour ?
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 09-14-2001, 01:22 PM
  5. Just to give you an idea of what we're going through...
    By rick barclay in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 09-13-2001, 02:09 PM