Paste in your completed code for golife and checkneighbors functions (a variation of these can be done for Sharks and Fishes):
void checkneighbors(struct individual board[ROWS][COLS], int rows,
int cols)
{
int row, col;
// Check the 1st and last rows, the 1st and last columns
// and the internal cells of the matrix (those not on the borders)
}
void golife(struct individual board[ROWS][COLS], int rows, int cols)
{
int row, col;
int count;
for(row=0; row<rows; row++) {
for(col=0; col<cols; col++) {
checkneighbors(board, rows, cols);
//Count the number of neighbors for each cell
}
}
for(row=0; row<rows; row++) {
for(col=0; col<cols; col++) {
// A dead cell with exactly three live neighbors becomes a live cell (birth).
// A live cell with two or three live neighbors stays alive (survival).
// In all other cases, a cell dies or remains dead (overcrowding or loneliness).
}
}
}