making an ANSI C program for Game of Life, kindly help me with this..

icy

Recruit
hi everyone!

Who knows C programming? I desperately need your help!
<


I need to create a C program that will read and print (using printf function) a text file containing a 25x25 matrix of the character 'X' and blank space (X corresponds to a living organism), this would be the initial generation, then will calculate the next generations and save it on another text file. Here's information about The Game of Life provided by my teacher:

The Game of Life, invented by John H. Conway, is supposed to model

the genetic laws for birth, survival, and death. We will play the game on a

board that consists of 25 squares in the horizontal and vertical directions (a

total of 625 squares). Each square can be empty, or it can contain an \X"

indicating the presence of an organism. Each square (except for the border

squares) has eight neighbors. The color shading shown in the following

segment of the board marks the neighbors of the organism named \X*":

Rules of the Game

The next generation of organisms is determined according to the follow-

ing criteria:

 1. Birth { An organism will be born in each empty location that has

exactly three neighbors.

 2. Death { An organism with four or more organisms as neighbors will

die from overcrowding. And organism with fewer than two neighbors

will die from loneliness.

 3. Survival { An organism with two or three neighbors will survive to the

next generation.

I am just a beginner in programming, and yet i have to use file pointers, file manipulations, to be able to finish my assignment (that i need to pass on tuesday). I have been reading C programming books and since i have no background on it, i'm really having a difficult time understanding some of the explanations. please, please do help me on this..
<
 
You are trying to climb mountain when you don't even know how to climb stairs , learn more about C.

BTW - There is a programming section.
 
Since its an assignment, I strongly suggest you to use that opportunity to learn. I don't see any point if someone who is familiar just hands over the code to you. Go through the basic, and *try* to program. For specific queries, I'm sure we will be able to help you out.
 
i'm starting my homework by trying to read, open the file i made containing my name and print it. i made this trial program and try to execute it in turbo c, but it displays some error saying undefined symbol for 'File' and 'fp'?

# include "stdio.h"

int main( )

{

FILE *fp ;

char n ;

fp = fopen ( "name.txt", "r" ) ;

while ( 1 )

{

n = fgetc ( fp ) ;

if ( n == EOF )

break ;

printf ( "%s", n) ;

}

fclose ( fp ) ;

return 0;

}

<
 
Back
Top