   # Get the living neighbors of `position`.  If there are exactly 2 or 3, this `position`
   # lives, otherwise it will be destroyed.
   # Returns itself if it should be destroyed, otherwise returns an empty list.
+  @spec to_destroy(position) :: [] | [pid]
   defp to_destroy(position) do
     position
     |> count_living_neighbors

  # Make sure the cell with PID `pid` is alive, and if so, return it.
  # Filter out `alive` processes since `terminate_child` will remove the cell from the Supervisor,
  # but it may not be fully removed from the Registry yet.
  defp lookup(position) do
    Cell.Registry
    |> Registry.lookup(position)

  end

  # Get all `{x, y}` coordinates of neighboring cells based on the input `{x, y}` and return them.
  @spec get_neighboring_positions(position) :: [position]
  defp get_neighboring_positions({x, y}) do
     @neighbor_offsets
     |> map(fn {dx, dy} -> {x + dx, y + dy} end)
  end

  # Filter out the `positions` which are not currently alive and return them.
  @spec get_dead_neighbors([position]) :: [position]
  defp get_dead_neighbors(positions) do
    filter(positions, &(lookup(&1) == nil))
  end
