prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Game of Life example needs update
  ### Package versions
  ```
  panel     = 0.13.1
  holoviews = 1.15.0
  bokeh     = 2.4.3
  ```
  
  
  ### Bug description
  In the Game of Life example in the holoviews documentation (https://holoviews.org/gallery/apps/bokeh/game_of_life.html) 
  I needed to update the second to last line
  ```python
  panel.add_periodic_callback(advance, 50)
  ```
  
  to
  ```python
  pn.state.add_periodic_callback(advance, period=50)   # 50 msec 
  # note: the `period=` is not necessary, but I think it adds clarity
  ```
  It seems this is due to a change in the `panel` interface.
  
  
  </issue>
  <code>
  [start of examples/gallery/apps/bokeh/game_of_life.py]
  1 import numpy as np
  2 import holoviews as hv
  3 import panel as pn
  4 
  5 from holoviews import opts
  6 from holoviews.streams import Tap, Counter, DoubleTap
  7 from scipy.signal import convolve2d
  8 
  9 hv.extension('bokeh')
  10 
  11 diehard = [[0, 0, 0, 0, 0, 0, 1, 0],
  12            [1, 1, 0, 0, 0, 0, 0, 0],
  13            [0, 1, 0, 0, 0, 1, 1, 1]]
  14 
  15 boat = [[1, 1, 0],
  16         [1, 0, 1],
  17         [0, 1, 0]]
  18 
  19 r_pentomino = [[0, 1, 1],
  20                [1, 1, 0],
  21                [0, 1, 0]]
  22 
  23 beacon = [[0, 0, 1, 1],
  24           [0, 0, 1, 1],
  25           [1, 1, 0, 0],
  26           [1, 1, 0, 0]]
  27 
  28 acorn = [[0, 1, 0, 0, 0, 0, 0],
  29          [0, 0, 0, 1, 0, 0, 0],
  30          [1, 1, 0, 0, 1, 1, 1]]
  31 
  32 spaceship = [[0, 0, 1, 1, 0],
  33              [1, 1, 0, 1, 1],
  34              [1, 1, 1, 1, 0],
  35              [0, 1, 1, 0, 0]]
  36 
  37 block_switch_engine = [[0, 0, 0, 0, 0, 0, 1, 0],
  38                        [0, 0, 0, 0, 1, 0, 1, 1],
  39                        [0, 0, 0, 0, 1, 0, 1, 0],
  40                        [0, 0, 0, 0, 1, 0, 0, 0],
  41                        [0, 0, 1, 0, 0, 0, 0, 0],
  42                        [1, 0, 1, 0, 0, 0, 0, 0]]
  43 
  44 glider = [[1, 0, 0], [0, 1, 1], [1, 1, 0]]
  45 
  46 unbounded = [[1, 1, 1, 0, 1],
  47             [1, 0, 0, 0, 0],
  48             [0, 0, 0, 1, 1],
  49             [0, 1, 1, 0, 1],
  50             [1, 0, 1, 0, 1]]
  51 
  52 shapes = {'Glider': glider, 'Block Switch Engine': block_switch_engine,
  53           'Spaceship': spaceship, 'Acorn': acorn, 'Beacon': beacon,
  54           'Diehard': diehard, 'Unbounded': unbounded}
  55 
  56 def step(X):
  57     nbrs_count = convolve2d(X, np.ones((3, 3)), mode='same', boundary='wrap') - X
  58     return (nbrs_count == 3) | (X & (nbrs_count == 2))
  59 
  60 def update(pattern, counter, x, y):
  61     if x and y:
  62         pattern = np.array(shapes[pattern])
  63         r, c = pattern.shape
  64         y, x = img.sheet2matrixidx(x,y)
  65         img.data[y:y+r,x:x+c] = pattern[::-1]
  66     else:
  67         img.data = step(img.data)
  68     return hv.Image(img)
  69 
  70 # Set up plot which advances on counter and adds pattern on tap
  71 title = 'Game of Life - Tap to place pattern, Doubletap to clear'
  72 img = hv.Image(np.zeros((100, 200), dtype=np.uint8))
  73 counter, tap = Counter(transient=True), Tap(transient=True),
  74 pattern_dim = hv.Dimension('Pattern', values=sorted(shapes.keys()))
  75 dmap = hv.DynamicMap(update, kdims=[pattern_dim], streams=[counter, tap])
  76 
  77 plot = dmap.opts(
  78     opts.Image(cmap='gray', clim=(0, 1), toolbar=None, responsive=True,
  79                min_height=800, title=title, xaxis=None, yaxis=None)
  80 )
  81 
  82 # Add callback to clear on double tap
  83 def reset_data(x, y):
  84     img.data[:] = 0
  85 
  86 reset = DoubleTap(transient=True, source=plot)
  87 reset.add_subscriber(reset_data)
  88 
  89 # Set up Panel app and periodic callback
  90 panel = pn.pane.HoloViews(plot, center=True, widget_location='right')
  91 
  92 def advance():
  93     counter.event(counter=counter.counter+1)
  94 panel.add_periodic_callback(advance, 50)
  95 
  96 panel.servable('Game of Life')
  97
  [end of examples/gallery/apps/bokeh/game_of_life.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/examples/gallery/apps/bokeh/game_of_life.py b/examples/gallery/apps/bokeh/game_of_life.py
  --- a/examples/gallery/apps/bokeh/game_of_life.py
  +++ b/examples/gallery/apps/bokeh/game_of_life.py
  @@ -91,6 +91,6 @@
   
   def advance():
       counter.event(counter=counter.counter+1)
  -panel.add_periodic_callback(advance, 50)
  +pn.state.add_periodic_callback(advance, period=50, start=False)
   
   panel.servable('Game of Life')
  
verification_info: {"golden_diff": "diff --git a/examples/gallery/apps/bokeh/game_of_life.py b/examples/gallery/apps/bokeh/game_of_life.py\n--- a/examples/gallery/apps/bokeh/game_of_life.py\n+++ b/examples/gallery/apps/bokeh/game_of_life.py\n@@ -91,6 +91,6 @@\n \n def advance():\n     counter.event(counter=counter.counter+1)\n-panel.add_periodic_callback(advance, 50)\n+pn.state.add_periodic_callback(advance, period=50, start=False)\n \n panel.servable('Game of Life')\n", "issue": "Game of Life example needs update\n### Package versions\r\n```\r\npanel     = 0.13.1\r\nholoviews = 1.15.0\r\nbokeh     = 2.4.3\r\n```\r\n\r\n\r\n### Bug description\r\nIn the Game of Life example in the holoviews documentation (https://holoviews.org/gallery/apps/bokeh/game_of_life.html) \r\nI needed to update the second to last line\r\n```python\r\npanel.add_periodic_callback(advance, 50)\r\n```\r\n\r\nto\r\n```python\r\npn.state.add_periodic_callback(advance, period=50)   # 50 msec \r\n# note: the `period=` is not necessary, but I think it adds clarity\r\n```\r\nIt seems this is due to a change in the `panel` interface.\r\n\n", "before_files": [{"content": "import numpy as np\nimport holoviews as hv\nimport panel as pn\n\nfrom holoviews import opts\nfrom holoviews.streams import Tap, Counter, DoubleTap\nfrom scipy.signal import convolve2d\n\nhv.extension('bokeh')\n\ndiehard = [[0, 0, 0, 0, 0, 0, 1, 0],\n           [1, 1, 0, 0, 0, 0, 0, 0],\n           [0, 1, 0, 0, 0, 1, 1, 1]]\n\nboat = [[1, 1, 0],\n        [1, 0, 1],\n        [0, 1, 0]]\n\nr_pentomino = [[0, 1, 1],\n               [1, 1, 0],\n               [0, 1, 0]]\n\nbeacon = [[0, 0, 1, 1],\n          [0, 0, 1, 1],\n          [1, 1, 0, 0],\n          [1, 1, 0, 0]]\n\nacorn = [[0, 1, 0, 0, 0, 0, 0],\n         [0, 0, 0, 1, 0, 0, 0],\n         [1, 1, 0, 0, 1, 1, 1]]\n\nspaceship = [[0, 0, 1, 1, 0],\n             [1, 1, 0, 1, 1],\n             [1, 1, 1, 1, 0],\n             [0, 1, 1, 0, 0]]\n\nblock_switch_engine = [[0, 0, 0, 0, 0, 0, 1, 0],\n                       [0, 0, 0, 0, 1, 0, 1, 1],\n                       [0, 0, 0, 0, 1, 0, 1, 0],\n                       [0, 0, 0, 0, 1, 0, 0, 0],\n                       [0, 0, 1, 0, 0, 0, 0, 0],\n                       [1, 0, 1, 0, 0, 0, 0, 0]]\n\nglider = [[1, 0, 0], [0, 1, 1], [1, 1, 0]]\n\nunbounded = [[1, 1, 1, 0, 1],\n            [1, 0, 0, 0, 0],\n            [0, 0, 0, 1, 1],\n            [0, 1, 1, 0, 1],\n            [1, 0, 1, 0, 1]]\n\nshapes = {'Glider': glider, 'Block Switch Engine': block_switch_engine,\n          'Spaceship': spaceship, 'Acorn': acorn, 'Beacon': beacon,\n          'Diehard': diehard, 'Unbounded': unbounded}\n\ndef step(X):\n    nbrs_count = convolve2d(X, np.ones((3, 3)), mode='same', boundary='wrap') - X\n    return (nbrs_count == 3) | (X & (nbrs_count == 2))\n\ndef update(pattern, counter, x, y):\n    if x and y:\n        pattern = np.array(shapes[pattern])\n        r, c = pattern.shape\n        y, x = img.sheet2matrixidx(x,y)\n        img.data[y:y+r,x:x+c] = pattern[::-1]\n    else:\n        img.data = step(img.data)\n    return hv.Image(img)\n\n# Set up plot which advances on counter and adds pattern on tap\ntitle = 'Game of Life - Tap to place pattern, Doubletap to clear'\nimg = hv.Image(np.zeros((100, 200), dtype=np.uint8))\ncounter, tap = Counter(transient=True), Tap(transient=True),\npattern_dim = hv.Dimension('Pattern', values=sorted(shapes.keys()))\ndmap = hv.DynamicMap(update, kdims=[pattern_dim], streams=[counter, tap])\n\nplot = dmap.opts(\n    opts.Image(cmap='gray', clim=(0, 1), toolbar=None, responsive=True,\n               min_height=800, title=title, xaxis=None, yaxis=None)\n)\n\n# Add callback to clear on double tap\ndef reset_data(x, y):\n    img.data[:] = 0\n\nreset = DoubleTap(transient=True, source=plot)\nreset.add_subscriber(reset_data)\n\n# Set up Panel app and periodic callback\npanel = pn.pane.HoloViews(plot, center=True, widget_location='right')\n\ndef advance():\n    counter.event(counter=counter.counter+1)\npanel.add_periodic_callback(advance, 50)\n\npanel.servable('Game of Life')\n", "path": "examples/gallery/apps/bokeh/game_of_life.py"}]}