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 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): angle = 18 x1 = x - cos(angle) * r y1 = y + sin(angle) * r length = cos(angle) * r * 2 star(x1, y1, length)

def china(x, y): jump(x, y) w = 300 h = 200 center_rect(x, y, w, h) center_star(x - 100, y + 50, 30) center_star(x - 50, y + 10, 10) center_star(x - 50, y + 80, 10) center_star(x - 50, y + 30, 10) center_star(x - 50, y + 60, 10)

china(0, 0)

5 条评论

  • @ 2023-7-30 10:22:58
    from wonderLang import *
    def china(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()
        centre_rect(x,y,300,200)
        centre_star(x-100,y+50,30)
        centre_star(x-50,y+10,10)
        centre_star(x-50,y+80,10)
        centre_star(x-30,y+30,10)
        centre_star(x-30,y+60,10)
    china(0,0)
    
    
    
    • @ 2023-5-23 21:04:18

      栓q

      • @ 2023-5-16 21:13:28

        老师课上讲过了

        • @ 2023-5-16 21:12:56
          from wonderLang import *
          
          
          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 cos(degree):
              import math
              radians = degree * math.pi / 180
              return math.cos(radians)
          
          
          def sin(degree):
              import math
              radians = degree * math.pi / 180
              return math.sin(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 china(x, y):
              jump(x, y)
              w = 300
              h = 200
              center_rect(x, y, w, h)
              center_star(x - 100, y + 50, 30)
              center_star(x - 50, y + 10, 10)
              center_star(x - 50, y + 80, 10)
              center_star(x - 30, y + 30, 10)
              center_star(x - 30, y + 60, 10)
          
          
          china(0, 0)
          
          • @ 2023-5-16 19:58:38

            代码块!!!代码块!!!

            • 1

            信息

            ID
            55
            时间
            1000ms
            内存
            256MiB
            难度
            5
            标签
            递交数
            1611
            已通过
            576
            上传者