On 2019-05-07 19:29, Eli the Bearded wrote:
In comp.lang.python, Paul Rubin  <no.email@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.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to