from wonderLang import *
import math
def polygon(sides, length):
    angle = 180 - ((sides - 2) * 180 / sides)
    i = 0
    while i < sides:
        forward(length)
        right(angle)
        i = i + 1
def circle(x, y, r):
    jump(x,y)
    sides=36
    left_angle = (90 + (360 / sides) / 2)
    length = 2 * math.pi * r / sides
    right(-left_angle)
    penup()
    forward(r)
    pendown()
    right(left_angle)
    polygon(sides, length)
def rect(x, y, w, h):
    jump(x,y)
    angle=90
    i=0
    while i < 2:
        forward(w)
        right(angle)
        forward(h)
        right(angle)
        i=i+1
def center_rect(x, y, w, h):
    jump(x,y)
    x1=x-w/2
    y1=y+h/2
    rect(x1,y1,w,h)
def star(x,y,length):
    jump(x,y)
    angle = 144
    i = 0
    while i < 5:
        forward(length)
        right(angle)
        i = i + 1
def sin(degree):
    import math
    radians = degree * math.pi / 180
    return math.sin(radians)
def cos(degree):
    import math
    radians = degree * math.pi / 180
    return math.cos(radians)
def center_star(x, y, r):
    jump(x, y)
    angle = 18
    x1 = x - cos(angle) * r
    y1 = y + sin(angle) * r
    length = cos(angle) * r * 2
    star(x1, y1, length)
def northkorea(x, y):
    jump(x, y)
    w=300
    h=200
    center_rect(x,y,w,h)
    w1=300
    h1=h*(1+15+1)/(4+1+15+1+4)
    center_rect(x,y,w1,h1)
    w2=300
    h2=h*15/(4+1+15+1+4)
    center_rect(x,y,w2,h2)
    r=h2*2/3/2
    circle(x-w/2/5*2,y,r)
    center_star(x-w/2/5*2,y,r)
northkorea(0,0)

3 条评论

  • @ 2023-8-29 9:22:40
    def rect(w,h,):
        i=0
        while i <2:
            forward(w)
            right(90)
            forward(h)
            right(90)
            i=i+1
    def center_rect(x, y, w, h):
        jump(x,y)
        jump(x-w/2,y+h/2)
        rect(w,h)
    
    
    def polygon(x,y,sides,length):
        jump(x,y,)
        i=0
        while i<sides:
            forward(length)
            right(360/sides)
            i=i+1
    
    
    def circle(x, y, r):
        jump(x,y+r)
        s=2*3.1415926*r
        length = s / 100
        polygon(x,y+r,100,length)
    
    def star(length):
        i=0
        while i<5:
            forward(length)
            right(144)
            i=i+1
    
    
    def center_star(x,y,r):
        jump(x,y)
        star_jump(x,y,r)
        length=star_length(r)
        star(length)
    
    
    
    def northkorea(x, y):
        center_rect(x,y,300,200)
        center_rect(x,y,300,200/(4+1+15+1+4)*(1+15+1))
        center_rect(x,y,300,200/(4+1+15+1+4)*15)
        circle(x-55,y,200/(4+1+15+1+4)*15/3)
        center_star(x-55,y,200/(4+1+15+1+4)*15/3)
    
    northkorea(0,0)
    
    
    • @ 2023-5-14 9:43:00

      看一下老师的讲解视频

      • @ 2023-5-13 7:33:39

        先问老师

        👎 1
        • 1

        信息

        ID
        60
        时间
        1000ms
        内存
        256MiB
        难度
        6
        标签
        递交数
        1673
        已通过
        517
        上传者