lib/game_of_life/board.rb
def coords_of_neighbors(x, y)
        coords_of_neighbors = []
        (x - 1).upto(x + 1).each do |neighbors_x|
          (y - 1).upto(y + 1).each do |neighbors_y|
            next if (x == neighbors_x) && (y == neighbors_y)
            coords_of_neighbors << [neighbors_x, neighbors_y]
          end
        end
        coords_of_neighbors
      end
def coords_of_neighbors(x, y)
        coords_of_neighbors = []
        (x - 1).upto(x + 1).each do |neighbors_x|
          (y - 1).upto(y + 1).each do |neighbors_y|
            next if (x == neighbors_x) && (y == neighbors_y)
            coords_of_neighbors << [neighbors_x, neighbors_y]
          end
        end
        coords_of_neighbors
      end
Calculates the co-ordinates of neighbors of a given pair of co-ordinates.
 @param [Integer] x the x-coordinate
 @param [Integer] y the y-coordinate
 @return [Array<Integer, Integer>] the list of neighboring co-ordinates
 @example
   coords_of_neighbors(1,1) =>
     [
       [0, 0], [0, 1], [0, 2],
       [1, 0],         [1, 2],
       [2, 0], [2, 1], [2, 2],
     ]
 @note This method returns all possible co-ordinate pairs of neighbors,
   so it can contain coordinates of cells not in the board, or negative ones.
 @see #neighbors_of_cell_at