prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  epstein_civil_violence box doesn't fit grid
  <img width="431" alt="screen shot 2018-04-01 at 10 05 11 pm" src="https://user-images.githubusercontent.com/166734/38180219-de2decf8-35f8-11e8-8d9b-562d2fb7c58b.png">
  
  ^^ Fix the outline grid on this model. The grid should be the same size as the outline.
  
  </issue>
  <code>
  [start of examples/epstein_civil_violence/civil_violence/server.py]
  1 from mesa.visualization.ModularVisualization import ModularServer
  2 from mesa.visualization.modules import CanvasGrid
  3 
  4 from .model import CivilViolenceModel
  5 from .agent import Citizen, Cop
  6 
  7 
  8 COP_COLOR = "#000000"
  9 AGENT_QUIET_COLOR = "#0066CC"
  10 AGENT_REBEL_COLOR = "#CC0000"
  11 JAIL_COLOR = "#757575"
  12 
  13 
  14 def citizen_cop_portrayal(agent):
  15     if agent is None:
  16         return
  17 
  18     portrayal = {"Shape": "circle",
  19                  "x": agent.pos[0], "y": agent.pos[1],
  20                  "Filled": "true"}
  21 
  22     if type(agent) is Citizen:
  23         color = AGENT_QUIET_COLOR if agent.condition == "Quiescent" else \
  24             AGENT_REBEL_COLOR
  25         color = JAIL_COLOR if agent.jail_sentence else color
  26         portrayal["Color"] = color
  27         portrayal["r"] = 0.8
  28         portrayal["Layer"] = 0
  29 
  30     elif type(agent) is Cop:
  31         portrayal["Color"] = COP_COLOR
  32         portrayal["r"] = 0.5
  33         portrayal["Layer"] = 1
  34     return portrayal
  35 
  36 
  37 model_params = dict(height=40,
  38                     width=40,
  39                     citizen_density=.7,
  40                     cop_density=.074,
  41                     citizen_vision=7,
  42                     cop_vision=7,
  43                     legitimacy=.8,
  44                     max_jail_term=1000)
  45 
  46 canvas_element = CanvasGrid(citizen_cop_portrayal, 40, 40, 500, 500)
  47 server = ModularServer(CivilViolenceModel, [canvas_element],
  48                        "Epstein Civil Violence", model_params)
  49
  [end of examples/epstein_civil_violence/civil_violence/server.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/epstein_civil_violence/civil_violence/server.py b/examples/epstein_civil_violence/civil_violence/server.py
  --- a/examples/epstein_civil_violence/civil_violence/server.py
  +++ b/examples/epstein_civil_violence/civil_violence/server.py
  @@ -43,6 +43,6 @@
                       legitimacy=.8,
                       max_jail_term=1000)
   
  -canvas_element = CanvasGrid(citizen_cop_portrayal, 40, 40, 500, 500)
  +canvas_element = CanvasGrid(citizen_cop_portrayal, 40, 40, 480, 480)
   server = ModularServer(CivilViolenceModel, [canvas_element],
                          "Epstein Civil Violence", model_params)
  
verification_info: {"golden_diff": "diff --git a/examples/epstein_civil_violence/civil_violence/server.py b/examples/epstein_civil_violence/civil_violence/server.py\n--- a/examples/epstein_civil_violence/civil_violence/server.py\n+++ b/examples/epstein_civil_violence/civil_violence/server.py\n@@ -43,6 +43,6 @@\n                     legitimacy=.8,\n                     max_jail_term=1000)\n \n-canvas_element = CanvasGrid(citizen_cop_portrayal, 40, 40, 500, 500)\n+canvas_element = CanvasGrid(citizen_cop_portrayal, 40, 40, 480, 480)\n server = ModularServer(CivilViolenceModel, [canvas_element],\n                        \"Epstein Civil Violence\", model_params)\n", "issue": "epstein_civil_violence box doesn't fit grid\n<img width=\"431\" alt=\"screen shot 2018-04-01 at 10 05 11 pm\" src=\"https://user-images.githubusercontent.com/166734/38180219-de2decf8-35f8-11e8-8d9b-562d2fb7c58b.png\">\r\n\r\n^^ Fix the outline grid on this model. The grid should be the same size as the outline.\n", "before_files": [{"content": "from mesa.visualization.ModularVisualization import ModularServer\nfrom mesa.visualization.modules import CanvasGrid\n\nfrom .model import CivilViolenceModel\nfrom .agent import Citizen, Cop\n\n\nCOP_COLOR = \"#000000\"\nAGENT_QUIET_COLOR = \"#0066CC\"\nAGENT_REBEL_COLOR = \"#CC0000\"\nJAIL_COLOR = \"#757575\"\n\n\ndef citizen_cop_portrayal(agent):\n    if agent is None:\n        return\n\n    portrayal = {\"Shape\": \"circle\",\n                 \"x\": agent.pos[0], \"y\": agent.pos[1],\n                 \"Filled\": \"true\"}\n\n    if type(agent) is Citizen:\n        color = AGENT_QUIET_COLOR if agent.condition == \"Quiescent\" else \\\n            AGENT_REBEL_COLOR\n        color = JAIL_COLOR if agent.jail_sentence else color\n        portrayal[\"Color\"] = color\n        portrayal[\"r\"] = 0.8\n        portrayal[\"Layer\"] = 0\n\n    elif type(agent) is Cop:\n        portrayal[\"Color\"] = COP_COLOR\n        portrayal[\"r\"] = 0.5\n        portrayal[\"Layer\"] = 1\n    return portrayal\n\n\nmodel_params = dict(height=40,\n                    width=40,\n                    citizen_density=.7,\n                    cop_density=.074,\n                    citizen_vision=7,\n                    cop_vision=7,\n                    legitimacy=.8,\n                    max_jail_term=1000)\n\ncanvas_element = CanvasGrid(citizen_cop_portrayal, 40, 40, 500, 500)\nserver = ModularServer(CivilViolenceModel, [canvas_element],\n                       \"Epstein Civil Violence\", model_params)\n", "path": "examples/epstein_civil_violence/civil_violence/server.py"}]}