Mr. Conway in 50 lines of code (Posting On Python-List Prohibited)

Wu Xi news at luegenpresse.edu
Mon Jan 1 08:51:00 EST 2018



the short versions are not equivalent, proggy won't work with them


> def neighbours(point):
>  x,y = point
>   
>  yield x + 1 , y
>  yield x - 1 , y
>  yield x     , y + 1
>  yield x     , y - 1                 #    this is proof that life can emerge inside of computers and cellular automatons,
>   
>  yield x + 1 , y + 1                 #    and evolve through memory, attack other cells and morph into toads, pulsars, etc..
>  yield x + 1 , y - 1
>  yield x - 1 , y + 1                 #    spray your memory with space alien patterns and life evolution will start in your machine !
>  yield x - 1 , y - 1
>  
>  '''
>  for i in range(-1, 2) :
>         for j in range(-1, 2) :
>             if i != j :
>                 yield x + i, y + j
> 
>  '''
>  # yield from [(x+i, x+j) for i in [-1,1] for j in [-1,1]]



More information about the Python-list mailing list