Борислав обнови решението на 02.04.2012 23:58 (преди над 12 години)
+def step_board(board):
+ next_board = [[0 for col in range (0,49)]for row in range(0,49)]
+ for row in range(1,49):
+ for col in range(1,49):
+ neighbours = [board[row - 1][col - 1:col + 2]] +(
+ [board[row][col -1]] + [board[row][col + 1]] +(
+ [board[row + 1][col - 1:col + 2]]))
+ if neighbours.count(1) == 3 or (
+ neighbours.count(1) == 2 and board[row][col] == 1):
+ next_board[row][col] = 1
+ for row in range(1,49):
+ for col in range(1,49):
+ board[row][col] = next_board[row][col]