# Difference: Lab7Kenyon (24 vs. 25)

#### Revision 252017-11-01 - JimSkon

Line: 1 to 1

 META TOPICPARENT name="WebHome"

# Lab 7 - Game of Life

Line: 41 to 41
%CODE{"c++"}% int const rows=22;
Changed:
<
<
int const columns = 8-0;
>
>
int const columns = 80;
char world[rows][columns]; %ENDCODE%
Line: 58 to 58
On startup have the program ask for coordinates of where to put *'s:
Changed:
<
<
```Welcom to LIFE.  Enter x and y coordinates where 1<=x<=80 and 1<=y<=20.  Enter x of -1 to end.

```
>
>
```Welcom to LIFE.  Enter row and column coordinates where 1<=row<=20 and 1<=column<=80.  Enter row of -1 to end.

```
Enter coordinate 1: 10 10 coordinate 2: 10 11 coordinate 3: 10 12
Line: 104 to 104
There should also be a function display that accepts the array world and displays the array on the screen. Is should merely display the contents of each row right to left.

### Design - the following routines might be useful:

Changed:
<
<
• int alive(char cell) - return a 1for alive('*'), and false otherwise. Used to check if a cell is alive.
>
>
• int alive(char cell) - return a 1 for alive('*'), and 0 otherwise. Used to check if a cell is alive.
• int neighborsAlive(car world [][82], int r, int c) - Return the number of neightbors of cell (r,c) that are alive. Simply add the Alive valuefor all the neigbors.

• char nextGenCell(char world[][82], int row, int column) - return a '*' if the cell at this location should be alive in the next generation. Otherwise return a space.
• void nextGenWorld(char current[ ][82]) - Given the current world, compute the next generation for the world. Note this changes the current world to a new world, so internally it will need to have some sort of temporary world to compute into, then it will need to copy that new world back over the current world.
• You find a LOT of interesting patterns here: conwaylife

Copyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback