aab6c36cbe6bf20590c5ea18932b5d9287295aac
1 from . import GridRenderer
2 from ..grid
import symbols
4 class LineGridRenderer(GridRenderer
):
5 """Renders a grid into a flat string, as puzzles are often presented in
11 class SquareGridRenderer(GridRenderer
):
12 """Renders a grid as a square of characters."""
14 def after_row(self
, row
, new_box
=False):
18 class AsciiArtGridRenderer(SquareGridRenderer
):
19 """Renders a questionably-pretty ASCII art drawing of a grid, with dividers
20 between rows and columns.
23 def inside_grid(self
, grid
):
24 box_header
= '+' + '-' * grid
._box_width
25 return box_header
* grid
._box_height
+ '+\n'
27 def inside_row(self
, row
):
30 def after_row(self
, row
):
33 def inside_cell(self
, cell
):
35 return symbols
[cell
.value
]