""" Demonstration code that uses Shape
 without knowing whether it is Square or Triangle
"""
from lectures.week3.shape import Shape
from lectures.week2.point import Point


def shape_place(mylist):
    """
    Place Shapes in mylist and draw them.

    @type mylist: list[Shape]
    @rtype: None
    """
    for s in mylist:
        for p in [(100, 0), (100, 200), (-200, -100)]:
            s.move_to(p[0], p[1])
            s.draw()

if __name__ == '__main__':
    # code that uses shape_place with specific Shapes
    from lectures.week3.square import Square
    from lectures.week3.right_angle_triangle import RightAngleTriangle
    L = [Square([Point(0, 0), Point(40, 0), Point(40, 40), Point(0, 40)]),
         RightAngleTriangle([Point(-100, 0), Point(0, 0), Point(-100, 50)])]
    shape_place(L)
    from time import sleep
    sleep(5)
