new_contents: from board import Board
  from canvas import Canvas
  from utils import intersperse
  
  
  class BoardView(Canvas):
      """
      Stores string canvas which is used to paint the board.  Also stores cursor
      position.
      """
      HOSHI = '+'
  
      HOSHIS = [
          (4, 4), (10, 4), (16, 4),
          (4, 10), (10, 10), (16, 10),
          (4, 16), (10, 16), (16, 16),
      ]
  
      CURSOR = 'X'
  
      def __init__(self, board):
          self._board = board
          self._cursor = (1, 1)
  
          super(BoardView, self).__init__(
              board._width * 2 - 1,
              board._height,
          )
  
          self._width = board._width
          self._height = board._height
  
      def _reset(self):
          board_canvas = self._board._canvas
  
          self._canvas = [
              intersperse(' ', [str(pos) for pos in row])
              for row in board_canvas
          ]
  
          for x, y in self.HOSHIS:
              if self.get(x, y) == str(Board.EMPTY):
                  self.set(x, y, self.HOSHI)
  
      def redraw(self):
          self._reset()
  
      def _array_coords(cls, x, y):
          return x * 2 - 2, y - 1
  
      def _in_width(self, v):
          return max(1, min(self._width, v))
  
      def _in_height(self, v):
          return max(1, min(self._height, v))
  
      def cursor_up(self):
          self._cursor = (
              self._in_width(self._cursor[0]),
              self._in_height(self._cursor[1] - 1),
          )
  
      def cursor_down(self):
          self._cursor = (
              self._in_width(self._cursor[0]),
              self._in_height(self._cursor[1] + 1),
          )
  
      def cursor_left(self):
          self._cursor = (
              self._in_width(self._cursor[0] - 1),
              self._in_height(self._cursor[1]),
          )
  
      def cursor_right(self):
          self._cursor = (
              self._in_width(self._cursor[0] + 1),
              self._in_height(self._cursor[1]),
          )
  
      @property
      def cursor(self):
          return self._cursor
  
      def __str__(self):
          canvas = self._copy
  
          if self._cursor:
              x, y = self._array_coords(
                  self._cursor[0],
                  self._cursor[1],
              )
              canvas[y][x] = self.CURSOR
  
          return '\n'.join([''.join(row) for row in canvas])
  
subject: Add view.py