prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Check desired orientation of binary to alphabet resource
  Currently is displayed in portrait but half the page is unused. May be better to switch to landscape which will increase the size of table cells.
  
  </issue>
  <code>
  [start of csunplugged/resources/views/binary_to_alphabet.py]
  1 """Module for generating Binary to Alphabet resource."""
  2 
  3 from PIL import Image, ImageDraw, ImageFont
  4 from utils.retrieve_query_parameter import retrieve_query_parameter
  5 
  6 
  7 def resource_image(request, resource):
  8     """Create a image for Binary to Alphabet resource.
  9 
  10     Args:
  11         request: HTTP request object
  12         resource: Object of resource data.
  13 
  14     Returns:
  15         A Pillow image object.
  16     """
  17     # Retrieve relevant image
  18     parameter_options = valid_options()
  19     worksheet_version = retrieve_query_parameter(request, "worksheet_version", parameter_options["worksheet_version"])
  20     if worksheet_version == "student":
  21         image_path = "static/img/resources/binary-to-alphabet/table.png"
  22     else:
  23         image_path = "static/img/resources/binary-to-alphabet/table-teacher.png"
  24     image = Image.open(image_path)
  25     draw = ImageDraw.Draw(image)
  26 
  27     font_size = 30
  28     font_path = "static/fonts/PatrickHand-Regular.ttf"
  29     font = ImageFont.truetype(font_path, font_size)
  30 
  31     # Draw headings
  32     column_headings = ["Base 10", "Binary", "Letter"]
  33     heading_coord_x = 18
  34     heading_coord_y = 6
  35 
  36     i = 0
  37     while i < 9:  # 9 = number of columns
  38 
  39         if i % 3 == 0:
  40             text = str(column_headings[0])
  41         elif i % 3 == 1:
  42             text = str(column_headings[1])
  43         else:
  44             text = str(column_headings[2])
  45 
  46         draw.text(
  47             (heading_coord_x, heading_coord_y),
  48             text,
  49             font=font,
  50             fill="#000"
  51         )
  52 
  53         heading_coord_x += 113
  54 
  55         i += 1
  56 
  57     # Draw numbers
  58     # Column data: (min number, max number), x coord
  59     columns_data = [((0, 9), 58), ((9, 18), 397), ((18, 27), 736)]
  60 
  61     for column_set in columns_data:
  62         start, end = column_set[0]
  63         base_coord_x = column_set[1]
  64         base_coord_y = 75
  65 
  66         for number in range(start, end):
  67             text = str(number)
  68             text_width, text_height = draw.textsize(text, font=font)
  69             coord_x = base_coord_x - (text_width / 2)
  70             coord_y = base_coord_y - (text_height / 2)
  71 
  72             draw.text(
  73                 (coord_x, coord_y),
  74                 text,
  75                 font=font,
  76                 fill="#000"
  77             )
  78 
  79             base_coord_y += 54
  80 
  81     return image
  82 
  83 
  84 def subtitle(request, resource):
  85     """Return the subtitle string of the resource.
  86 
  87     Used after the resource name in the filename, and
  88     also on the resource image.
  89 
  90     Args:
  91         request: HTTP request object
  92         resource: Object of resource data.
  93 
  94     Returns:
  95         text for subtitle (string)
  96     """
  97     text = "{} - {}".format(
  98         retrieve_query_parameter(request, "worksheet_version"),
  99         retrieve_query_parameter(request, "paper_size")
  100     )
  101     return text
  102 
  103 
  104 def valid_options():
  105     """Provide dictionary of all valid parameters.
  106 
  107     This excludes the header text parameter.
  108 
  109     Returns:
  110         All valid options (dict).
  111     """
  112     return {
  113         "worksheet_version": ["student", "teacher"],
  114         "paper_size": ["a4", "letter"]
  115     }
  116
  [end of csunplugged/resources/views/binary_to_alphabet.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/csunplugged/resources/views/binary_to_alphabet.py b/csunplugged/resources/views/binary_to_alphabet.py
  --- a/csunplugged/resources/views/binary_to_alphabet.py
  +++ b/csunplugged/resources/views/binary_to_alphabet.py
  @@ -78,6 +78,7 @@
   
               base_coord_y += 54
   
  +    image = image.rotate(90, expand=True)
       return image
  
verification_info: {"golden_diff": "diff --git a/csunplugged/resources/views/binary_to_alphabet.py b/csunplugged/resources/views/binary_to_alphabet.py\n--- a/csunplugged/resources/views/binary_to_alphabet.py\n+++ b/csunplugged/resources/views/binary_to_alphabet.py\n@@ -78,6 +78,7 @@\n \n             base_coord_y += 54\n \n+    image = image.rotate(90, expand=True)\n     return image\n", "issue": "Check desired orientation of binary to alphabet resource\nCurrently is displayed in portrait but half the page is unused. May be better to switch to landscape which will increase the size of table cells.\n", "before_files": [{"content": "\"\"\"Module for generating Binary to Alphabet resource.\"\"\"\n\nfrom PIL import Image, ImageDraw, ImageFont\nfrom utils.retrieve_query_parameter import retrieve_query_parameter\n\n\ndef resource_image(request, resource):\n    \"\"\"Create a image for Binary to Alphabet resource.\n\n    Args:\n        request: HTTP request object\n        resource: Object of resource data.\n\n    Returns:\n        A Pillow image object.\n    \"\"\"\n    # Retrieve relevant image\n    parameter_options = valid_options()\n    worksheet_version = retrieve_query_parameter(request, \"worksheet_version\", parameter_options[\"worksheet_version\"])\n    if worksheet_version == \"student\":\n        image_path = \"static/img/resources/binary-to-alphabet/table.png\"\n    else:\n        image_path = \"static/img/resources/binary-to-alphabet/table-teacher.png\"\n    image = Image.open(image_path)\n    draw = ImageDraw.Draw(image)\n\n    font_size = 30\n    font_path = \"static/fonts/PatrickHand-Regular.ttf\"\n    font = ImageFont.truetype(font_path, font_size)\n\n    # Draw headings\n    column_headings = [\"Base 10\", \"Binary\", \"Letter\"]\n    heading_coord_x = 18\n    heading_coord_y = 6\n\n    i = 0\n    while i < 9:  # 9 = number of columns\n\n        if i % 3 == 0:\n            text = str(column_headings[0])\n        elif i % 3 == 1:\n            text = str(column_headings[1])\n        else:\n            text = str(column_headings[2])\n\n        draw.text(\n            (heading_coord_x, heading_coord_y),\n            text,\n            font=font,\n            fill=\"#000\"\n        )\n\n        heading_coord_x += 113\n\n        i += 1\n\n    # Draw numbers\n    # Column data: (min number, max number), x coord\n    columns_data = [((0, 9), 58), ((9, 18), 397), ((18, 27), 736)]\n\n    for column_set in columns_data:\n        start, end = column_set[0]\n        base_coord_x = column_set[1]\n        base_coord_y = 75\n\n        for number in range(start, end):\n            text = str(number)\n            text_width, text_height = draw.textsize(text, font=font)\n            coord_x = base_coord_x - (text_width / 2)\n            coord_y = base_coord_y - (text_height / 2)\n\n            draw.text(\n                (coord_x, coord_y),\n                text,\n                font=font,\n                fill=\"#000\"\n            )\n\n            base_coord_y += 54\n\n    return image\n\n\ndef subtitle(request, resource):\n    \"\"\"Return the subtitle string of the resource.\n\n    Used after the resource name in the filename, and\n    also on the resource image.\n\n    Args:\n        request: HTTP request object\n        resource: Object of resource data.\n\n    Returns:\n        text for subtitle (string)\n    \"\"\"\n    text = \"{} - {}\".format(\n        retrieve_query_parameter(request, \"worksheet_version\"),\n        retrieve_query_parameter(request, \"paper_size\")\n    )\n    return text\n\n\ndef valid_options():\n    \"\"\"Provide dictionary of all valid parameters.\n\n    This excludes the header text parameter.\n\n    Returns:\n        All valid options (dict).\n    \"\"\"\n    return {\n        \"worksheet_version\": [\"student\", \"teacher\"],\n        \"paper_size\": [\"a4\", \"letter\"]\n    }\n", "path": "csunplugged/resources/views/binary_to_alphabet.py"}]}