code: def play(self):
          
  
          # Write the initial configuration to file.
  
          self.t = 1  # Current time level
          while self.t <= self.T:  # Evolve!
              # print( "At time level %d" % t)
  
              # Loop over each cell of the grid and apply Conway's rules.
              for i in range(self.N):
                  for j in range(self.N):
                      live = self.live_neighbours(i, j)
                      if (self.old_grid[i][j] == 1 and live < 2):
                          self.new_grid[i][j] = 0  # Dead from starvation.
                      elif (self.old_grid[i][j] == 1 and (live == 2 or live == 3)):
                          self.new_grid[i][j] = 1  # Continue living.
                      elif (self.old_grid[i][j] == 1 and live > 3):
                          self.new_grid[i][j] = 0  # Dead from overcrowding.
                      elif (self.old_grid[i][j] == 0 and live == 3):
                          self.new_grid[i][j] = 1  # Alive from reproduction.
  
              # Output the new configuration.
  
              # The new configuration becomes the old configuration for the next generation.
              self.old_grid = self.new_grid.copy()
              self.draw_board()
              # Move on to the next time level
              self.t += 1
docs: Play Conway's Game of Life.