##okhan 3/6/00
##5B
##Twist and split square triangle squares

g.antialias (1)

while 1:

   def poly (xlt, ylt, xrt, yrt, xrb, yrb, xlb, ylb):
      g.line(xlt, ylt, xrt, yrt)
      g.line(xrt, yrt, xrb, yrb)
      g.line(xrb, yrb, xlb, ylb)
      g.line(xlb, ylb, xlt, ylt)
   

   for x in range (0, 61):
      for y in range (0, 30):

         Ax= (55-(x/3))
         Ay= (24+(x/3))
         Bx= (80-(x/3))
         By= (24-(x/3))
         Cx= (80-(x/3))
         Cy= (50+(x/3))
         Dx= (55+(x/3))
         Dy= (50-(x/3))
         g.paper(100)
         g.pen(0)
         poly (Ax, Ay, Bx, By, Cx, Cy, Dx, Dy)
      
   a= 0
   for x in range(61, 100):
      for y in range(0, 30):
         #top triangle coordinates
         Ex= (80-(x/3))
         Ey= ((13+2*a)+(x/3))
         Fx= (55+(x/3)-a/2)
         Fy= ((50+2*a)-(x/3)+a)
         Gx= (40+(x/3))
         Gy= ((50+a)+(x/3))
         Hx= (80-(x/3))
         Hy= ((50+a)+(x/3))

         #bottom triangle coordinates
         Ix= ((55-a)-(x/3))
         Iy= (24+(x/3)-3*a)
         Jx= ((80-a)-(x/3))
         Jy= (24-(x/3))
         Kx= ((80-a)-(x/3))
         Ky= (13+(x/3)-2*a)
         Lx= ((55-a)-(x/3))
         Ly= (24+(x/3)-2*a)

         g.pen(100)
         g.paper(0)
         poly (Ex, Ey, Fx, Fy, Gx, Gy, Hx, Hy)
         poly (Ix, Iy, Jx, Jy, Kx, Ky, Lx, Ly)
       
      a=(a+1)