Conway's game of Life, just because.

MRAB python at mrabarnett.plus.com
Tue May 7 14:54:03 EDT 2019


On 2019-05-07 19:29, Eli the Bearded wrote:
> In comp.lang.python, Paul Rubin  <no.email at nospam.invalid> wrote:
> 
> Thanks for posting this. I'm learning python and am very familiar with
> this "game".
> 
>> #!/usr/bin/python3
>> from itertools import chain
>> 
>> def adjacents(cell):            # generate coordinates of cell neighbors
>>     x, y = cell                 # a cell is just an x,y coordinate pair
>>     return ((x+i,y+j) for i in [-1,0,1] for j in [-1,0,1] if i or j)
> 
[snip]
> 
> Elijah
> ------
> is the torus game board unintentional?
> 
I've never seen a version of Conway's Game of Life where the board 
doesn't wrap around.



More information about the Python-list mailing list