hello all,
Im in desperate need to do an assignment on Game of life in C language!
And despite doing programming for 1 week, i still dont know how to implement this or write program in a proper manner! I have been reading books, looking for info on it o the internet, but i cant seem to start it..as I said, Im really not an ace in computer programming and I have to return this assignment by friday and if anyone could help me with this, ill be really grateful!
The program consists of:
Assignment
The Problem: The Game of Life
The game of life is a simple cellular automaton where the world is a 2D grid of cells which have two states: alive or dead. After each iteration, the new state of a cell is determined by the state of its neighbors at the previous iteration. This includes both the nearest neighbors and the
diagonal neighbors. i.e. like a 9 point stencil without using the value of the cell itself as input. The rules for the evolution of the system are:
• If a cell has exactly two alive neighbors, it maintains state.
• If a cell has exactly three alive neighbors, it is alive.
• Otherwise, the cell is dead.
Your code will need to:
1. Initialize the gameboard
2. Start loop:
a) Print the gameboard (temporarily for correctness checking)
b) Calculate number of live neighbors
c) If (live neighbors = 3) then live
d) If (live neighbors < 2) or (live neighbors > 3) then die
3. End loop
4. Print final gameboard (again for correctness checking):huh: :huh:
Its supposed to be an array of [15][15]..with functions...:huh: oh well, i dont know..plz someone help!!! ive been designing it on a piece of paper, but cant seem to know where to start.. I want to do it on my own, but I really need an enlightment, i think!!! thanks in advance!
Please, help me with this...Im a chemical engineering student, never knew i had to do programming!
Im in desperate need to do an assignment on Game of life in C language!
And despite doing programming for 1 week, i still dont know how to implement this or write program in a proper manner! I have been reading books, looking for info on it o the internet, but i cant seem to start it..as I said, Im really not an ace in computer programming and I have to return this assignment by friday and if anyone could help me with this, ill be really grateful!
The program consists of:
Assignment
The Problem: The Game of Life
The game of life is a simple cellular automaton where the world is a 2D grid of cells which have two states: alive or dead. After each iteration, the new state of a cell is determined by the state of its neighbors at the previous iteration. This includes both the nearest neighbors and the
diagonal neighbors. i.e. like a 9 point stencil without using the value of the cell itself as input. The rules for the evolution of the system are:
• If a cell has exactly two alive neighbors, it maintains state.
• If a cell has exactly three alive neighbors, it is alive.
• Otherwise, the cell is dead.
Your code will need to:
1. Initialize the gameboard
2. Start loop:
a) Print the gameboard (temporarily for correctness checking)
b) Calculate number of live neighbors
c) If (live neighbors = 3) then live
d) If (live neighbors < 2) or (live neighbors > 3) then die
3. End loop
4. Print final gameboard (again for correctness checking):huh: :huh:
Its supposed to be an array of [15][15]..with functions...:huh: oh well, i dont know..plz someone help!!! ive been designing it on a piece of paper, but cant seem to know where to start.. I want to do it on my own, but I really need an enlightment, i think!!! thanks in advance!
Please, help me with this...Im a chemical engineering student, never knew i had to do programming!