Nov-13-2019, 12:36 PM
Looping of matrix is simple. Some examples:
>>> m = [[1, 0, 0, 0, 1], ... [0, 0, 0, 0, 0], ... [0, 1, 0, 0, 0], ... [0, 1, 0, 0, 0]] >>> for row in m: ... print(row) ... [1, 0, 0, 0, 1] [0, 0, 0, 0, 0] [0, 1, 0, 0, 0] [0, 1, 0, 0, 0] >>> for col in zip(*m): ... print(col) ... (1, 0, 0, 0) (0, 0, 1, 1) (0, 0, 0, 0) (0, 0, 0, 0) (1, 0, 0, 0)Your actual problem is how to change values adjacent to zombie values. As this includes next/previous rows you should figure out when to make 'infection' happen.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.