from wonderLang import *
import math
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 polygon2(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
    length = (2 * math.pi * r) / sides
    left_angle = (90 + (360 / sides) / 2)
    right(-left_angle)
    forward(r)
    right(left_angle)
    polygon2(sides,length)
def sin(degree):
    radians = degree * math.pi / 180
    return math.sin(radians)
def cos(degree):
    radians = degree * math.pi / 180
    return math.cos(radians)
def star(x,y,length):
    jump(x, y)
    angle = 144
    i = 0
    while i < 5:
        forward(length)
        right(angle)
        i = i + 1
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):
    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,y,r)
    center_star(x-w/2/5,y,r)

northkorea(0,0)

6 条评论

  • @ 2023-8-2 20:06:56
    from wonderLang import *
    def northkorea(x,y):
        def centre_rect(x, y, w, h):
            i = 0
            jump(x - w / 2, y + h / 2)
            while i < 2:
                forward(w)
                right(90)
                forward(h)
                right(90)
                i = i + 1
    
        def centre_star(x, y, r):
            star_jump(x, y, r)
            length = star_length(r)
            def star():
                i = 0
                while i < 5:
                    forward(length)
                    right(144)
                    i = i + 1
            star()
    
        def circle(x, y, r):
            i = 0
            jump(x, y + r)
            while i < 100:
                forward(2 * 3.1415926 * r / 100)
                right(360 / 100)
                i = i + 1
    
        centre_rect(x,y,300,200)
        centre_rect(x,y,300,200/25*17)
        centre_rect(x,y,300,200/25*15)
        jump(x-55,y)
        circle(x-55,y,200/25*5)
        jump(-55,y)
        centre_star(x-55,y,200/25*5)
    
    northkorea(0,0)
    
    
    • @ 2023-7-24 10:41:00
      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 circle(x,y,r):
          jump(x,y)
          jump(x,y + r)
          s = 2 * 3.1415926 * r
          lenth = s / 100
          i = 0
          while i < 100:
              forward(lenth)
              right(360/100)
              i = i + 1
      
      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)
          lenth = star_length(r)
          star(lenth)
      
      def northkorea(x, y):
          jump(x,y)
          w = 300
          h = 200
          center_rect(x,y,w,h)
          center_rect(x,y,w,h / (4 + 1 + 15 + 1 + 4) * 17)
          center_rect(x,y,w,h / (4 + 1 + 15 + 1 + 4) * 15)
          circle(x - 55,y,h / (4 + 1 + 15 + 1 + 4) * 15 / 3)
          center_star(x - 55 ,y,h / (4 + 1 + 15 + 1 + 4) * 15 / 3)
      northkorea(0,0)
      
      • @ 2023-7-24 10:40:26

        你看讲解,没这么多行

        • @ 2023-5-25 12:49:53

          你在pycharm里前面的题目中定义了,但是在网站中没有

          • @ 2023-5-25 12:46:47

            你的

            rect and star
            

            没定义!!!

            • @ 2023-5-25 13:25:47

              这里你回答可以用内行代码,比如:

              你的rectandstar没定义!

              源码:

              # ***你的`rect`and`star`没定义!***
              
          • @ 2023-5-25 12:44:07
            def star(x,y,length):
                jump(x,y)
                angle = 144
                i = 0
                while i < 5:
                    forward(length)
                    right(angle)
                    i = i + 1
            
            def cender_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 polygon2(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
                length = (2 * math.pi * r) / sides
                left_angle = (90 + (360 / sides) / 2)
                right(-left_angle)
                forward(r)
                right(left_angle)
                polygon2(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 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):
                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)
                cender_star(x - w / 2 / 5 * 2,y,r)
            
            northkorea(0,0)
            
            • 1

            信息

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