In the previous assignment, we have represented a polymer as a list containing the positions of the successive monomers of the polymer. Each position is represented as a tuple $$(x,y)$$, where $$x,y \in \mathbb{Z}$$. The first monomer is always placed at the origin $$(0,0)$$ of the Cartesian plane, and the next position is always one unit step up, down, left or right of the previous position. Two monomers of the same polymer can never occupy the same position.

Assignment

Write a function showPolymer which prints the structure of a polymer for a given list of positions of the monomers of a polymer (which is to be passed to the function as argument). To do this, just follow these steps:

Example

>>> polymer1 = [(0, 0), (1, 0), (2, 0), (2, 1), (2, 2), (1, 2), (0, 2), 
...              (0, 1), (1, 1)]
>>> showPolymer(polymer1)
o-o-o
|   |
o-* o
    |
x-o-o
>>> polymer2 = [(0, 0), (1, 0), (2, 0), (2, -1), (3, -1), (4, -1), (4, 0), 
...              (4, 1), (3, 1), (3, 0)]
>>> showPolymer(polymer2)
      o-o
      | |
x-o-o * o
    |   |
    o-o-o
>>> polymer3 = [(0, 0), (0, -1), (1, -1), (1, -2), (1, -3), (1, -4), (0, -4), 
...              (0, -3), (-1, -3), (-2, -3), (-2, -2), (-2, -1), (-1, -1), 
...              (-1, -2), (0, -2)]
>>> showPolymer(polymer3)
    x  
    |  
o-o o-o
| |   |
o o-* o
|     |
o-o-o o
    | |
    o-o