Conway's Game of Life - in JavaScript

This simple JavaScript implementation of the Game of Life is an exercise for COMP3001 students learning JavaScript. It is functional, but the source code has been minified to make it as obscure as possible. You are expected to use the students' starting point as the basis for your JavaScript implementation. It contains most of the code and comments, so you can see an example of a proper JavaScript program interacting with a web page in a style that used to be called "Dynamic HTML". You have to fill in the missing bits, signified by four question marks at various places ????.

This implementation of Conway's Game of Life uses a table of 10x10 cells to store and display the current board. An in-memory array is used to styore the state of each cell in the next generation. The link between table cell (i,j) and array value [i][j] is that the HTML table cell has an id "ij" (e.g. cell[4][5] -> <td id="45">).

0

1

2

3

4

5

6

7

8

9

0

1

2

X

X

X

3

4

5

6

7

8

9

Your challenges:

Finish the code by replacing the ???? sections with JavaScript to make the Game of Life work. The comments should give you enough to go on.

If you click on the spaces between cells, the program breaks. Put in some guards to stop this happening.

Extend the code so that it works with a bigger table. 100x100? 1000x1000? At what point does an HTML table become unweildy?

Look up Timers in JavaScript and find out how to animate successive generations.

Find a way to create a library of interesting patterns that can be loaded into the grid by the user.