# Problem 7B # # Create a generally smooth gradation of white to # black, from left to right using only a 100 percent black pen import math g.paper(0) g.pen(100) g.norefresh() distribution = [] for n in range(102): distribution.append(0) def spiraller(xc, yc, radius, turns, points, array=distribution): for n in range(points): x = int(xc + float(n)/points*radius*math.cos(turns*float(n)/points)) y = int(yc + float(n)/points*radius*math.sin(turns*float(n)/points)) if n % 2 == 0: if x < 102 and x > -1 and y > -1 and y < 102 and array[x] < x: array[x] = array[x] + 1 g.setPixel(x,y,100) while 1: n = n+1 spiraller(110,50,120,n%50,n) g.refresh() #g.paper(0)