1234567891011121314151617181920212223 |
- import pygame
- from settings import *
- def cell_checker(field, x, y):
- neighbors = 0
- for i in range(y - 1, y + 2):
- for i2 in range(x - 1, x + 2):
- if field[i][i2]:
- neighbors += 1
- if field[y][x]:
- neighbors -= 1
- if neighbors == 2 or neighbors == 3:
- return 1
- else:
- return 0
- else:
- if neighbors == 3:
- return 1
- else:
- return 0
|