import math
def japan(x,y):
    w = 300
    h = 200
    center_rect(x, y, w, h)
    r = h * 3 / 5 / 2
    circle(x,y,r)
japan(0,0)

8 条评论

  • @ 2023-8-5 12:16:32
    from wonderLang import *
    def japan(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 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
        circle(x,y,200/5*3/2)
        jump(x-300/2,y+200/5)
        centre_rect(x,y,300,200)
    japan(0,0)
    
    • @ 2023-7-27 20:58:18
      from wonderLang import *
      def a(x,y,b,c):
          jump(x,y)
          i=0
          while i<2:
              forward(b)
              right(90)
              forward(c)
              right(90)
              i=i+1
      def japan(x,y):
          jump(x,y+3/2)
          a=2*3.1415926*(3/5)
          i=0
          while i<100:
              forward(a)
              right(360/100)
              i=i+1
      a(-100,100,300,200)
      japan(50, 60)
      
      • @ 2023-7-9 10:57:46

        有两个你在Japan里调用的函数没有被声明,把前两个代码复制过来,位置、大小改一下就行了

        • @ 2023-4-5 12:09:37
          center_rect(x, y, w, h)
          circle(x,y,r)
          

          这两个函数没有定义,看我刚才发的那个是定义过的

          • @ 2023-4-5 12:05:44
            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 japan(x, y):
                width = 300
                height = 200
                center_rect(x,y,width,height)
                r = height * 3 / 5 / 2
                circle(x,y,r)
            
            japan(0,0)
            

            应该是这样做

            • @ 2023-3-17 21:41:14

              这些题老师课上都讲过了

              • $\color{red}{这位同学您好,您已连续发无意义违规讨论 9 篇,请迅速删除并按照规则发送有序讨论}$

              • @ 2023-3-12 21:13:54

                啊呀!这些最基础的错误你要自己debug出来的,这样的wyy讨论你已经发了好多个了,你还是去看看我们以前我们发布的讨论吧!有热心同学推送下链接吗?

              • 1

              信息

              ID
              53
              时间
              1000ms
              内存
              256MiB
              难度
              6
              标签
              递交数
              2064
              已通过
              591
              上传者