# Problem 7A
#
# Create a general method for abstractly filling the DBN paper area at
# variable percentages. In a display loop, show the 25 percent, 50
# percent, and 75 percent solutions in rotation.

import math

g.paper(100)
g.pen(0)
g.norefresh()

def spiraller(xc, yc, radius, turns, points, color):
    canvas = []
    for n in range(points):
        x1 = xc + float(n)/points*radius*math.cos(turns+float(n)/points)
        y1 = yc + float(n)/points*radius*math.sin(turns+float(n)/points)
        g.setPixel(int(x1),int(y1),color)


def fillspace(space, color):
        g.paper(100-color)
        for n in range(space):
                spiraller(50,50,75,float(n)/4,100,color)
                g.refresh()
        g.paper(100-color)

        
def space(percent):
        return int(percent*1.5)
        
while 1:
        fillspace(space(25),100)
        fillspace(space(50),75)
        fillspace(space(75),0)