The LifeGame from John Conway is a very simple way to " simulate  life ". There is a logic board, in wich each cell are empty or not.

- Rules:
• If a cell has two "neighbours", it stays alive.
• If a empty cell has three "neighbours", it becomes alive.
• If a cell has less than two "neighbours" or more than three "neighbour", it becomes empty.

- Simulate with Javascript (with Netscape 2.0, or Microsoft IE 3.0):

The table is 10*10 (when you try bigger, it becomes very slow at the begginning). I use checkbox to represent cells. For using it, you just have to " draw " a population of cells by clicking on checkbox. Click on "OK" to start and "Stop" to stop.

- Programming in Javascript:

1)Main Process:
If (the game is on)
1) read the table ( liretab())
2) compute for the future population ( genfutur() )
3) show the new table ( afftab() )
4) Pause ( setTimeout )


2) The rules work by the function etatfutur() who needs the result of number of neighbours provided by nbvoisins(). In this game, the ends meet.

So we use functions to compute col number and row number from the number of cell.
The cell number 7 is no col 2 and row 1.
n° col = (n° cell) modulo (nb col) (ex: 7 modulo 5 =2)
n° row = (n° cell) integer division (nb row) (ex: 7 div 5=1)
n° cell = (n° row)*(nbrow)+(n° col)

Books:
" Artificial life: The Quest of a new creation "
Steven Levy - Pantheon -1992