Thread: Conway's Life - C Program - Errors have me stumped - Please help

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    your indentation style is very hard to follow...
    You have one missing } because of it
    Code:
    void new_board(char b1[][21], char b2[][21]) 
    {
    	int i, j, p;
    	for (i=0; i<20; i++) 
    	{
    		for (j=0; j<20; j++) 
    		{
    			p=neighbours(i,j);
    			if(b1[i][j]=='*')
    			{
    				if(p==2||p==3)
    				{
    					b2[i][j] = '*';
    				} 
    				else 
    				{
    					b2[i][j] = '.';
    				}
    			} //missing
    			else 
    			{
    				if (neighbours == 3) 
    				{
    					b2[i][j] = '*';                        /*	b2 corresponding position gets a '*' */
    				} 
    				else 
    				{
    					b2[i][j] = '.';			                                     /*b2 gets a '.' */
    				}
    			}
    		}
    	}
    	/*	b2[i][j] = '\0'; 	 ----assign  ????? \0 */
    }
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  2. #2
    Registered User
    Join Date
    May 2007
    Posts
    12
    Excellent! That did the trick, thank you! Now the program actually runs, asks me to play, after I enter 'y' - it creates another board, then stops =/ But progress at last. I'll have a go at fixing this when I get home. Thank you to everyone that helped me get this far.

    ~Sarah87

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program giving errors
    By andy bee in forum C Programming
    Replies: 5
    Last Post: 08-11-2010, 10:38 PM
  2. Errors with program to replace string with another
    By Dan17 in forum C Programming
    Replies: 3
    Last Post: 09-14-2006, 10:15 AM
  3. Need help to solve program errors
    By pattop in forum C++ Programming
    Replies: 6
    Last Post: 05-28-2006, 01:57 AM
  4. C++ Game of Life Program
    By rayrayj52 in forum C++ Programming
    Replies: 16
    Last Post: 09-26-2004, 03:58 PM
  5. Simple Program wont execute after compiles w. no errors
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 02-03-2002, 04:24 PM