from ti_graphics import * from math import * def hline(x, y1, y2, Color): setColor(Color) drawLine(x, y1, x, y2) B=(0,)*3 W=(255,)*3 G=(0,255,0) DG=(0,128,0) f = lambda x: -(sqrt(cos(x))*cos((320-84)*x)+sqrt(fabs(x))-0.7)*(4-x**2)**0.01*1.3*320/8 y4, y2 = f(pi/4), f(pi/2) l=[] for i in range(320): x=((i-160)/320)*5 l.append(ceil((cos(x)<0 and y2 or f(x))+y4-y2+30)) imax = int(input("N="))*320 cls() setColor(B) fillRect(0,30,320,210) i = 0 while imax > 0: hline(i%320,l[i],l[i-1],W) hline((i-5)%320,l[i-5],l[i-6],G) hline((i-291)%320,l[i-291],l[i-292],DG) hline((i-296)%320,l[i-296],l[i-297],B) i = (i + 1) % 320 imax -= 1