from wonderLang import * import math

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_reck(x,y,w,h) center_star(x-100,y+50,30) right(18) center_star(x - 50, y + 10, 10) right(18) center_star(x - 50, y + 80, 10) right(18) center_star(x - 30, y + 30, 10) right(18) center_star(x - 30, y + 60, 10)

china(100,100)

2 条评论

  • @ 2023-1-12 16:12:07

    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 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): 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)

    • @ 2022-12-13 21:16:08
      from wonderLang import *
      import math
      
      def rect(x,y,w,h):
          jump(x,y)
          angle = 90
          i = 0
          angle = 90
          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 - 30, y + 30, 10)
          center_star(x - 30, y + 60, 10)
      china(0,0)
      

      可以这样

    • 1