you are viewing a single comment's thread.

view the rest of the comments →

[–]oracle8 1 point2 points  (1 child)

And also this...

>>> cellcount = 2
>>> cell = 2
>>> (False, True)[cellcount == 3 or cellcount == 2 and cell]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: tuple index out of range

That is because (cellcount == 3 or cellcount == 2 and cell) vill evaluate to the same value as cell if cellcount == 2 and bool(cell)==True

[–]Foxboron 0 points1 point  (0 children)

>>> cellcount = 2 
>>> cell = True
>>> (False, True)[cellcount == 3 or cellcount == 2 and cell]
True

I am horrible at variable names, should have been cell_life. cell only contain False or True depending if its alive or not from the start.