GoL - #include <iostream.h> #include <conio.h>...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream.h> #include <conio.h> #include <fstream.h> #include <windows.h> #include <cstring.h> /************************************************** Name: Hung Truong Program: Game of Life Instructor: Mr. Barkeshli Purpose: Input: Output: **************************************************/ const int TOPX=5;const int Y_SIZE=40; const int X_SIZE=70; const int TOPY=5;const char char_Alive='x';const char char_Dead='.'; void Init(int array[][Y_SIZE+2]); /************************ Function: Init(int ) Purpose: To initiate an array to be all '0' Argument: an array Return: change the value of each cell of array to '0' ************************/ void ShowWorld(int array[][Y_SIZE+2]); /**************************** Function: ShowWorld(int array) Purpose: Show the array to the screen Argument: an array Return: don't return but print the cell in the array into screen ****************************/ void PutCell(int i, int j, bool Alive); /**************************** Function PutCell() Purpose: Use to mark the position the alive or dead Argument: 2 int and 1 boolean variables Return: Mark the cell (i,j) as alive or dead ****************************/ void Step(int array[][Y_SIZE+2]); /**************************** Function Step() Purpose: Function of step- for one generation of cell lives Argument: The main array included the cell lives ****************************/ int Neighbor(int array[][Y_SIZE+2],int x, int y); /**************************** Function: Neighbor(int array, int ) Purpose: Return the numbers of alive cell among point (x,y) Argument: the main array and 2 int x,y as the point (x,y) Return: The numbers of alive cell among (x,y) ****************************/ void WriteIn(ofstream &fout,int array[][Y_SIZE+2]); /**************************** Function: WriteIn()
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

GoL - #include &lt;iostream.h&gt; #include &lt;conio.h&gt;...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online