某冰岚吧 关注:96贴子:3,358

回复:flash版的logo语言

只看楼主收藏回复


to d多角星 a r;a角数r外接圆半径
home
make d REMAINDER a 2
make e a/2 make b round a/2 make b b-1 make c 2*r *(sin ((180/a)*b)) pu fd r
if d=1 then [rt 180-90/a pd REPEAT a [fd c rt 180-180/a]]
if d=0 then [rt 180 fd 2*r rt 180-180/a pd REPEAT e[fd c rt 180-360/a] pu home fd r rt 180-180/a pd REPEAT e[fd c rt 180-360/a]]
pu home pd
end


45楼2016-10-15 23:37
回复

    to k空心多角星 a r
    home
    make d REMAINDER a 2
    make e a/2 make b (round a/2)-1 make c 2*r *(sin ((180/a)*b)) pu fd r
    make g (round a/2)-2 make f 90-180*g/a make h sqrt(r*r-(c*c/4)) make i h/((sin(f))/(cos(f))) make j c/2-i
    if d=1 then [rt 180-90/a pd REPEAT a [fd j pu fd (i*2) pd fd j rt 180-180/a]]
    if d=0 then [rt 180 fd 2*r rt 180-180/a pd REPEAT e[fd j pu fd (i*2) pd fd j rt 180-360/a] pu home fd r rt 180-180/a pd REPEAT e[fd j pu fd (i*2) pd fd j rt 180-360/a]]
    pu home pd
    end


    46楼2016-10-17 02:09
    回复

      系统没定义反三角函数,正弦函数就很难画了.
      一个导数公式似乎有用,又不知道怎么用!!!
      不去计算了,反正画出来的本来就不准确让海龟自己走
      ;ƒ(x) = a * sin(bx + c) + d,,,,a振幅,,,,b周期最小正周期T=2π/abs(b),,,,c向x负方向偏离的弧度,,,,d向y负方向偏
      to z正弦曲线 a b c d
      home
      make e 1300
      make f -650
      pu setxy f ((a *(sin(b*f+c)))+d) pd dot f ((a *(sin(b*f+c)))+d)
      REPEAT e[setxy f ((a *(sin(b*f+c)))+d) make f f+1]
      pu home pd
      end
      看起来不是很平滑但是能用,这是用填充看看会不会填到外面去得到的图片


      48楼2016-10-17 23:28
      收起回复

        ARCTAN 求反正切
        【格式】ARCTAN X
        这是系统自带的唯一的反函数这两天一直没有办法解决正切图像的问题
        还有个问题就是解析几何用的是弧度,这边用的是度,要转化成弧度就把x换成(2*pi)/360
        to tan a
        op ((sin(a))/(cos(a)))
        end
        tan 45
        0.9999999999999999
        REPEAT 100[ fd tan 45]
        在fd命令中能用
        但是make a tan 45赋值不成功
        可见自定义函数虽然可以有返回值但是不能用在赋值语句跟表达式中
        这一点非常坑!!有很多功能都完不成


        49楼2016-10-21 23:45
        收起回复

          to z正切曲线 a b c d
          home
          make e 1500
          make f -750
          make g int 1500/(180/b)
          if g=0 then [make g 1]
          if c>180/b then [make c c-(int((c/(180/b))))*(180/b)]
          if c<(-180)/b then [make c c+(int((c/(180/b))))*(180/b)]
          make h (90/b-c+(round g/2-1)*(180/b))*(-1)+3
          pu setxy h (a*((sin(b*h+c))/(cos(b*h+c))))+d pd
          REPEAT g[REPEAT 180/b-6[setxy h (a*((sin(b*h+c))/(cos(b*h+c))))+d make h h+1] pu make h h+5 setxy h (a*((sin(b*h+c))/(cos(b*h+c))))+d make h h+1 pd]
          pu home pd
          end
          没用反正切,有空会用上的
          左右平移还是没做到,平移就全都给填成黑色了



          51楼2016-10-22 13:00
          收起回复

            to z正切曲线 a b c d
            home
            new make i pid
            make e 2000
            make f -1000
            make g int e/(180/b)
            if g=0 then [make g 1]
            if c>180/b then [make j c-(int(c/(180/b)))*(180/b)] else[make j c]
            if c>180/b then [make j c+(int(c/(180/b)))*(180/b)] else[make j c]
            make h (90/b+(round g/2-1)*(180/b))*(-1)+3
            pu setxy h (a*((sin(b*h))/(cos(b*h))))+d pd
            REPEAT g[REPEAT 180/b-4[setxy h (a*((sin(b*h))/(cos(b*h))))+d make h h+1] pu make h h+3 setxy h (a*((sin(b*h))/(cos(b*h))))+d make h h+1 pd]
            pu psxy i (-1)*j 0 home pd
            end
            这个可以大概画出正切曲线,不是以海龟为中心的,而且还会多建一个图层,斜率高的地方可能会断线填充会外漏
            ;z正切曲线 40 1 0 0


            52楼2016-10-22 22:09
            回复
              to g格子线 a b c d
              ;g格子线 100 50 10 7
              ;a竖线的距离b横线的距离c横线的数目d竖线的数目
              home
              pu setxy a*(c-1)/2 b*(d-1)/(-2)
              make e 1
              REPEAT c[pd fd b*(d-1) pu setxy a*(c-1)/2-a*e b*(d-1)/(-2) make e e+1]
              pu setxy a*(c-1)/2 b*(d-1)/(-2)
              make e 1
              lt 90
              REPEAT d[pd fd a*(c-1) pu setxy a*(c-1)/2 b*(d-1)/(-2)+b*e make e e+1]
              pu home pd
              end
              to g格子线有内框 a b c d f
              ;g格子线有内框 100 50 10 7 10
              ;a竖线的距离b横线的距离c横线的数目d竖线的数目f内框与边的距离
              home
              pu setxy a*(c-1)/2 b*(d-1)/(-2)
              make e 1
              REPEAT c[pd fd b*(d-1) pu setxy a*(c-1)/2-a*e b*(d-1)/(-2) make e e+1]
              pu setxy a*(c-1)/2 b*(d-1)/(-2)
              make e 1
              lt 90
              REPEAT d[pd fd a*(c-1) pu setxy a*(c-1)/2 b*(d-1)/(-2)+b*e make e e+1]
              make e 0
              REPEAT d-1[pu setxy a*(c-1)/2-f b*(d-1)/(-2)+f+e*b REPEAT c-1[ pd fd a-2*f pu fd 2*f] make e e+1]
              make e 0
              REPEAT d-1[pu setxy a*(c-1)/2-f b*(d-1)/2-f-e*b REPEAT c-1[ pd fd a-2*f pu fd 2*f] make e e+1]
              rt 90
              make e 0
              REPEAT c-1[pu setxy a*(c-1)/(-2)+f+e*a b*(d-1)/(-2)+f REPEAT d-1[ pd fd b-2*f pu fd 2*f] make e e+1]
              make e 0
              REPEAT c-1[pu setxy a*(c-1)/2-f-e*a b*(d-1)/2-fREPEAT d-1[ pd bk b-2*f pu bk 2*f] make e e+1]
              pu home pd
              end


              54楼2016-10-24 12:48
              回复
                to g格子线双线 a b c d g
                ;g格子线双线 100 50 10 7 10
                ;a竖线的距离b横线的距离c横线的数目d竖线的数目f双线的距离
                home lt 90 make f g/2 make e 0
                REPEAT d-1[pu setxy a*(c-1)/2 b*(d-1)/(-2)+f+e*b pd fd c*a-a make e e+1]
                make e 0
                REPEAT d-1[pu setxy a*(c-1)/2 b*(d-1)/2-f-e*b pd fd c*a-a make e e+1]
                rt 90 make e 0
                REPEAT c-1[pu setxy a*(c-1)/(-2)+f+e*a b*(d-1)/(-2) pd fd d*b-b make e e+1]
                make e 0
                REPEAT c-1[pu setxy a*(c-1)/2-f-e*a b*(d-1)/2 pd bk d*b-b make e e+1]
                pu setxy a*(c-1)/2 b*(d-1)/(-2) pd fd b*(d-1) lt 90 fd a*(c-1) lt 90 fd b*(d-1) lt 90 fd a*(c-1)
                pu home pd
                end


                56楼2016-10-24 22:10
                回复
                  to f蜂窝 a b
                  ;f蜂窝 40 6
                  ;a半径=边长b层数
                  home
                  if b=1 then[pu rt 30 fd a pd rt 120 REPEAT 6[fd a rt 60] pu home pd go lb]
                  ;4*b-1;线的层数
                  make f 4*b-1
                  make e 2*b
                  for j 1 f [make g 2*b+1-e make k f-g+1 if k<(b+1) then [make g k] if g >b then [if (REMAINDER b 2)=(REMAINDER g 2) then [make g b setxy a*((-1.5)*(g-1)-0.5) (cos(30))*(e-1)*a seth -30 pd fd a bk a seth 30 bk a fd a pu setxy a*((1.5)*(g-1)+0.5) (cos(30))*(e-1)*a seth 30 pd fd a bk a seth -30 bk a fd a pu]] if g >b then [ make g b-1] pu if (REMAINDER g 2)=1 then [setxy a*((-1.5)*(g-1)-0.5) (cos(30))*(e-1)*a for i 1 g [pd if e>1 then [seth 30 bk a fd a seth 90 fd a seth -30 bk a fd a seth 90 pu fd 2*a] if e<1 then [seth -30 fd a bk a seth 90 fd a seth 30 fd a bk a seth 90 pu fd 2*a] if e=1 then [seth 90 fd a pu fd 2*a ] ] ] if (REMAINDER g 2)=0 then [setxy a*((-1.5)*g+1) (cos(30))*(e-1)*a seth 90 for i 1 g [pd if e>1 then [seth 30 bk a fd a seth 90 fd a seth -30 bk a fd a seth 90 pu fd 2*a ] if e<1 then [seth -30 fd a bk a seth 90 fd a seth 30 fd a bk a seth 90 pu fd 2*a ] if e=1 then [seth 90 fd a pu fd 2*a ] ] ] if e=1 then[setxy a*((-1.5)*(g-1)-0.5) (cos(30))*(e-1)*a seth -30 pd fd a bk a seth 30 bk a fd a pu setxy a*((1.5)*(g-1)+0.5) (cos(30))*(e-1)*a seth 30 pd fd a bk a seth -30 bk a fd a pu] make e e-1 ]
                  pu home pd
                  label lb
                  end


                  60楼2016-11-05 12:32
                  回复
                    to s设置按钮变量框
                    setvar mouse mouse,-633,368,0,0,1,0xffffee,0x0,0x0
                    setvar pid pid,-633,249,300,0,1,0xffffee,0x0,0x0
                    setvar pc pc,-631,219,15,0,0,0xffffee,0x0,0x0
                    setvar bg bg,-633,189,15,0,0,0xffffee,0x0,0x0
                    setvar heading heading,-636,338,360,-360,1,0xffffee,0x0,0x0
                    setvar alpha alpha,-634,277,1,0,1,0xffffee,0x0,0x0
                    setvar pattern pattern,-636,307,21,0,1,0xffffee,0x0,0x0
                    setvar xcor xcor,-522,278,400,-400,1,0xffffee,0x0,0x0
                    setvar ycor ycor,-524,249,400,-400,1,0xffffee,0x0,0x0
                    setvar t_x轴 x,-531,219,300,0,1,0xffffee,0x0,0x0
                    setvar t_y轴 y,-531,187,300,0,1,0xffffee,0x0,0x0
                    setvar b步长 步长,-439,164,300,0,1,0xffffee,0x0,0x0
                    setvar x存1 x,-400,364,300,0,1,0xffffee,0x0,0x0
                    setvar y存1 y,-400,339,300,0,1,0xffffee,0x0,0x0
                    setvar t_h轴 h,-632,162,300,0,1,0xffffee,0x0,0x0
                    setvar h存1 h,-400,312,300,0,1,0xffffee,0x0,0x0
                    setvar x存2 x,-296,364,300,0,1,0xffffee,0x0,0x0
                    setvar y存2 y,-296,339,300,0,1,0xffffee,0x0,0x0
                    setvar h存2 h,-296,312,300,0,1,0xffffee,0x0,0x0
                    setvar x存3 x,-192,364,300,0,1,0xffffee,0x0,0x0
                    setvar y存3 y,-192,339,300,0,1,0xffffee,0x0,0x0
                    setvar h存3 h,-192,312,300,0,1,0xffffee,0x0,0x0
                    setvar x存4 x,-88,364,300,0,1,0xffffee,0x0,0x0
                    setvar y存4 y,-88,339,300,0,1,0xffffee,0x0,0x0
                    setvar h存4 h,-88,312,300,0,1,0xffffee,0x0,0x0
                    setvar x存5 x,16,364,300,0,1,0xffffee,0x0,0x0
                    setvar y存5 y,16,339,300,0,1,0xffffee,0x0,0x0
                    setvar h存5 h,16,312,300,0,1,0xffffee,0x0,0x0
                    setvar t_p偏 偏,-369,255,300,0,1,0xffffee,0x0,0x0
                    make b步长 25 svar b步长
                    setbut cmd,刷新,-457,365,54,22,0xffff99,0x0,14 for,t_i,0,100,[svar,mouse,svar,pid,svar,pc,svar,bg,svar,heading,svar,alpha,svar,patten,svar,xcor,svar,ycor,wait,5],
                    setbut cmd_1,跟鼠标画线,-511,337,108,18,0xffff99,0x0,14 for,t_ii,0,1000,[,if,button,=1,then,[setxy,mousex,mousey],if,button,=2,then,[stop],wait,3],
                    setbut cmd_2,跟鼠标填充,-511,308,108,20,0xffff99,0x0,14 pu,for,t_i,0,1000,[,if,button,=1,then,[setxy,mousex,mousey,fill],if,button,=2,then,[pd,stop],wait,3],
                    setbut cmd_4,↓,-396,196,30,27,0xffff99,0x0,14 seth,180+t_p偏,fd,b步长,
                    setbut cmd_5,置坐标,-496,159,58,17,0xffff99,0x0,14 setxy,t_x轴,t_y轴,svar,xcor,svar,ycor,
                    setbut cmd_6,→,-369,223,35,24,0xffff99,0x0,14 seth,90+t_p偏,fd,b步长,
                    setbut cmd_7,←,-428,223,35,23,0xffff99,0x0,14 seth,270+t_p偏,fd,b步长,
                    setbut cmd_8,↑,-395,250,29,26,0xffff99,0x0,14 seth,0+t_p偏,fd,b步长,
                    setbut cmd_9,⊙,-396,223,30,22,0xffff99,0x0,14 for,t_ii,0,1000,[,make,t_f,Rc,if,t_f="j,then,[seth,270+t_p偏,fd,b步长],if,t_f="k,then,[seth,180+t_p偏,fd,b步长],if,t_f="l,then,[seth,90+t_p偏,fd,b步长],if,t_f="i,then,[seth,0+t_p偏,fd,b步长],if,t_f="f,then,[pu],if,t_f="q,then,[stop],if,t_f="d,then,[pd],],
                    setbut cmd_10,存,-407,285,30.95,23,0xffff99,0x0,14 make,x存1,xcor,make,y存1,ycor,make,h存1,heading,svar,x存1,svar,y存1,svar,h存1,
                    setbut cmd_11,载,-380,285,37,23,0xffff99,0x0,14 make,t_x轴,x存1,make,t_y轴,y存1,make,t_h轴,h存1,svar,t_x轴,svar,t_y轴,svar,t_h轴,make,x中间b,xcor,make,y中间b,ycor,make,h中间b,heading,pu,setxy,x存1,y存1,seth,h存1,wait,6,setxy,x中间b,y中间b,seth,h中间b,pd,
                    setbut cmd_12,置,-346,285,37,23,0xffff99,0x0,14 setxy,x存1,y存1,seth,h存1,svar,xcor,svar,ycor,
                    setbut cmd_13,存,-304,285,33,23,0xffff99,0x0,14 make,x存2,xcor,make,y存2,ycor,make,h存2,heading,svar,x存2,svar,y存2,svar,h存2,
                    setbut cmd_14,载,-276,285,37,23,0xffff99,0x0,14 make,t_x轴,x存2,make,t_y轴,y存2,make,t_h轴,h存2,svar,t_x轴,svar,t_y轴,svar,t_h轴,make,x中间b,xcor,make,y中间b,ycor,make,h中间b,heading,pu,setxy,x存2,y存2,seth,h存2,wait,6,setxy,x中间b,y中间b,seth,h中间b,pd,
                    setbut cmd_15,置,-242,285,37,23,0xffff99,0x0,14 setxy,x存2,y存2,seth,h存2,svar,xcor,svar,ycor,
                    setbut cmd_16,存,-201,285,33,23,0xffff99,0x0,14 make,x存3,xcor,make,y存3,ycor,make,h存3,heading,svar,x存3,svar,y存3,svar,h存3,
                    setbut cmd_17,载,-172,285,37,23,0xffff99,0x0,14 make,t_x轴,x存3,make,t_y轴,y存3,make,t_h轴,h存3,svar,t_x轴,svar,t_y轴,svar,t_h轴,make,x中间b,xcor,make,y中间b,ycor,make,h中间b,heading,pu,setxy,x存3,y存3,seth,h存3,wait,6,setxy,x中间b,y中间b,seth,h中间b,pd,
                    setbut cmd_18,置,-140,285,37,23,0xffff99,0x0,14 setxy,x存3,y存3,seth,h存3,svar,xcor,svar,ycor,
                    setbut cmd_19,存,-97,285,33,23,0xffff99,0x0,14 make,x存4,xcor,make,y存4,ycor,make,h存4,heading,svar,x存4,svar,y存4,svar,h存4,
                    setbut cmd_20,载,-68,285,37,23,0xffff99,0x0,14 make,t_x轴,x存4,make,t_y轴,y存4,make,t_h轴,h存4,svar,t_x轴,svar,t_y轴,svar,t_h轴,make,x中间b,xcor,make,y中间b,ycor,make,h中间b,heading,pu,setxy,x存4,y存4,seth,h存4,wait,6,setxy,x中间b,y中间b,seth,h中间b,pd,
                    setbut cmd_21,置,-36,285,37,23,0xffff99,0x0,14 setxy,x存4,y存4,seth,h存4,svar,xcor,svar,ycor,
                    setbut cmd_22,存,7,285,33,23,0xffff99,0x0,14 make,x存5,xcor,make,y存5,ycor,make,h存5,heading,svar,x存5,svar,y存5,svar,h存5,
                    setbut cmd_23,载,36,285,37,23,0xffff99,0x0,14 make,t_x轴,x存5,make,t_y轴,y存5,make,t_h轴,h存5,svar,t_x轴,svar,t_y轴,svar,t_h轴,make,x中间b,xcor,make,y中间b,ycor,make,h中间b,heading,pu,setxy,x存5,y存5,seth,h存5,wait,6,setxy,x中间b,y中间b,seth,h中间b,pd,
                    setbut cmd_24,置,68,285,37,23,0xffff99,0x0,14 setxy,x存5,y存5,seth,h存5,svar,xcor,svar,ycor,
                    setbut cmd_25,方向,-540,158,44,16,0xffff99,0x0,14 seth,t_h轴,
                    setbut cmd_26,说明,-440,192,44,23,0xffcc00,0x0,14 pr,'pattern填充图案号,pr,'ALPHA透明度,pr,'跟鼠标单机操作右击退出,pr,'⊙ikjl上下左右f抬d落q退,pr,'按钮''载''会落笔,
                    end


                    61楼2016-11-05 12:48
                    回复
                      ;这是用来填充单调带格子的图形的程序
                      TO s随机填充 a b c
                      ;s随机填充 400 300 200
                      ;0黑1蓝2绿3蓝绿4红5紫红6棕7亮灰8暗灰9亮蓝10亮绿11亮蓝绿12亮红13亮紫14亮棕15白
                      ;ax by c次数
                      pu home
                      ;下面的ktchong是可填充颜色的字表,可以去掉不想要的颜色的代码
                      ;可以删掉下面这行,在主程序里定义,用来操控想要的填充颜色
                      make ktchong [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]
                      ;随机数的最后一个数,,,出现的概率比别的数低...所以不用最后一个数
                      for i 1 c [SETPC int(RANDOM 16) if pc=bg then [go lb] make j member? pc ktchong if j=1 then[make d (RANDOM a)-a/2 make e (RANDOM b)-b/2 make g (DOTCOLOR [d e]) if g=bg then [setxy d e fill]] label lb]
                      home pd
                      END


                      62楼2016-11-07 12:23
                      收起回复
                        先预热
                        主要是一组图层之间的联动计算
                        就是一组图形在运动的时候能感觉是一个整体
                        主要用到的数学知识是圆的参数方程
                        x=a+rsind
                        y=b+rcosd
                        难点是串起来所有相关的图层要涉及到很多变量之间的协调
                        下面是比较粗糙的两图联动
                        to g跟随运动
                        make r 100 ;图a与b的距离(旋转中心的距离)
                        make chp 30 ;图b相对于图a的偏离角度
                        ;画a与b旋转中心的连线(便于观察)
                        ;图a就是这个连线
                        make a pid setxy r*(sin(chp)) r*(cos(chp))
                        make chp1 120;图c相对于图b的偏离角度(不涉及图c只是方便观察)
                        make r1 30 ;图b与c的距离(旋转中心的距离)
                        ;画b与c旋转中心的连线(便于观察)
                        ;图b就是这个连线
                        make b pid setxy r*(sin(chp))+r1*(sin(chp1)) r*(cos(chp))+r1*(cos(chp1))
                        ;a图与b图都做好了位置关系也确定了
                        pu
                        ;让a图旋转 保存位置方向
                        ask a rt 90 make c pxcor a make d pycor a make e pa a
                        ;b图跟随a图旋转(chp+e是初始偏离角度+现在的角度)(cd是现在的坐标)
                        psxy b (c+r*(sin(chp+e))) (d+r*(cos(chp+e))) PSA b e;让b图旋转 保存位置方向
                        ask b rt 90 make c pxcor b make d pycor b make e pa b
                        ;a图跟随b图旋转(chp+180是a图相对于b图的初始偏离角度)(cd是现在的坐标)
                        psxy a (c+r*(sin(chp+180+e))) (d+r*(cos(chp+180+e))) ask a rt 90
                        end


                        64楼2016-12-02 23:49
                        收起回复
                          我看着这个楼,由衷地说:害怕


                          IP属地:黑龙江来自Android客户端68楼2016-12-17 22:36
                          收起回复
                            ;下面是一些中断函数
                            ;第一个是停一段时间继续执行程序(主要是检查画面,通过b的提醒可以找到出错的位置)
                            ;第二个是停一段时间输出变量的值到屏幕然后继续(主要检查变量有没有算错)
                            ;第三个是一直停,按y时继续,按n时停止程序(设置暂停点,方便截图及录制gif动画)
                            TO d断点 a b
                            ;a为停留秒数a为负数显示c的值a为0选择题停止还是继续
                            ;b最好是解释性的文字,比如子程序名称,行数,执行到那一步
                            ;d断点 3 "第n行
                            make d_d []
                            IF a<0 OR a=0 THEN [make d_d FPUT a d_d make d_d FPUT "第一个变量不能为 d_d say 3 d_d WAIT 300 STOP]
                            make d_d LPUT b d_d make d_d LPUT a d_d
                            make d_d LPUT "秒断点 d_d SAY a d_d
                            WAIT a*100
                            END
                            TO b变量追踪 a b c
                            ;显示变量c的值
                            ;b最好是解释性的文字,比如子程序名称,行数,执行到那一步
                            ;b变量追踪 3 "第n行追踪c 4
                            IF a<0 OR a=0 THEN [make d_d FPUT a d_d make d_d FPUT "第一个变量不能为 d_d say 3 d_d WAIT 300 STOP]
                            make d_d []
                            make d_d fPUT "变量追踪 d_d make d_d LPUT b d_d make d_d LPUT c d_d
                            SAY a d_d
                            WAIT a*100
                            end
                            TO x选退断点 a b
                            ;漏洞KEY的值是编辑框里的最后一个字母
                            ;要确定在编辑框里的最后一个字母不是y不是n
                            ;b最好是解释性的文字,比如子程序名称,行数,执行到那一步
                            ;x选退断点 3 "第n行
                            IF a<0 OR a=0 THEN [make d_d FPUT a d_d make d_d FPUT "第一个变量不能为 d_d say 3 d_d WAIT 300 STOP]
                            make d_d [] make e_e 0
                            make d_d fPUT "y继续,n退出 d_d make d_d fPUT b d_d
                            say a d_d wait a*100
                            label lb2 make d_d bf d_d make e_e KEY
                            IF e_e=121 then [SAY a "您按了y继续执行程序 wait a*100 GO lb1]
                            if e_e=110 then [say a "您按了n现在退出子程序 WAIT a*100 stop]
                            make d_d fPUT e_e d_d say a d_d wait a*100
                            GO lb2
                            label lb1
                            END


                            69楼2016-12-18 22:51
                            回复
                              ;※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
                              ;※ 下面几个函数是一个整体 要把※改成具体的表的名称才能用 ※※※※※※
                              ;※ 对表的操作 ※※※※※※
                              ;※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
                              TO s删※第n个 n;删除字表※的第n个元素
                              make t_shu COUNT ※
                              IF t_shu<n THEN [SAY 3 "字表元素数小于n WAIT 300 stop]
                              IF n<1 THEN [SAY 3 "n太小 WAIT 300 stop]
                              make t_rus [] make i_i 1 make t1_shu 0
                              label lb2 IF i_i=n THEN [GO lb3 ]
                              make t1_shu ITEM i_i ※ make t_rus LPUT t1_shu t_rus
                              label lb3 make i_i i_i+1 IF i_i>t_shu then [make ※ t_rus STOP] go lb2
                              END
                              TO g改※第n个 n a;把字表※的第n个元素改为a
                              make t_shu COUNT ※
                              IF t_shu<n THEN [SAY 3 "字表元素数小于n WAIT 300 stop]
                              IF n<1 THEN [SAY 3 "n太小 WAIT 300 stop]
                              make t_rus [] make i_i 1 make t1_shu 0
                              label lb2 IF i_i=n THEN [make t1_shu a make t_rus LPUT t1_shu t_rus GO lb3]
                              make t1_shu ITEM i_i ※ make t_rus LPUT t1_shu t_rus
                              label lb3 make i_i i_i+1 IF i_i>t_shu then [make ※ t_rus STOP] go lb2
                              END
                              TO c插入※ n a;插入元素a到字表※,在n的前面插入,当n>字表长度在后面添加,当n<1=n=1
                              make t_shu COUNT ※
                              IF t_shu<n THEN [make ※ LPUT a ※ stop]
                              IF n<1 THEN [make ※ FPUT a ※ stop]
                              make t_rus [] make i_i 1 make t1_shu 0
                              label lb2 IF i_i=n THEN [make t1_shu a make t_rus LPUT t1_shu t_rus make t1_shu ITEM i_i ※ make t_rus LPUT t1_shu t_rus GO lb3]
                              make t1_shu ITEM i_i ※ make t_rus LPUT t1_shu t_rus
                              label lb3 make i_i i_i+1 IF i_i>t_shu then [make ※ t_rus STOP] go lb2
                              END
                              TO c查找※位置存入※※ a
                              make t_shu COUNT ※
                              make i_i 1 make t1_shu 0
                              label lb2 make t1_shu ITEM i_i ※ IF t1_shu=a THEN [make ※※ i_i stop]
                              make i_i i_i+1 IF i_i>t_shu then [make ※※ 0 SAY 3 "表※中未查到元素 WAIT 300 STOP]
                              go lb2
                              END
                              ;※※※※※※※※※※※※※※※下面的3个函数是一个整体 ※※※※※※※※※※※※※※※
                              ;※※1※※1※※1※※1※※1※※1※※※
                              TO x※排序
                              make t_shu COUNT ※
                              make t1_shu first ※
                              make t_rus [] make t_rus FPUT t1_shu t_rus make i_i 2
                              label lb2 make t1_shu ITEM i_i ※
                              make i_ii 1 label lb1 make t2_shu ITEM i_ii t_rus
                              IF t2_shu>t1_shu THEN [c插入t_rus i_ii t1_shu GO lb3] make i_ii i_ii+1
                              IF i_ii=i_i THEN [c插入t_rus i_ii t1_shu GO lb3] GO lb1
                              label lb3 make i_i i_i+1 IF i_i>t_shu then [make ※ t_rus STOP] go lb2
                              END
                              ;※※2※※2※※2※※2※※2※※2※※※
                              TO c插入t_rus n a;为了避免变量耦合所以变量名后面都加了1
                              make t_shu1 COUNT t_rus
                              IF t_shu1<n THEN [make t_rus LPUT a t_rus stop]
                              IF n<1 THEN [make t_rus FPUT a t_rus stop]
                              make t_rus1 [] make i_i1 1 make t1_shu1 0
                              label lb2 IF i_i1=n THEN [make t1_shu1 a make t_rus1 LPUT t1_shu1 t_rus1 make t1_shu1 ITEM i_i1 t_rus make t_rus1 LPUT t1_shu1 t_rus1 GO lb3]
                              make t1_shu1 ITEM i_i1 t_rus make t_rus1 LPUT t1_shu1 t_rus1
                              label lb3 make i_i1 i_i1+1 IF i_i1>t_shu1 then [make t_rus t_rus1 STOP] go lb2
                              END
                              ;※※3※※3※※3※※3※※3※※3※※※
                              TO x※排倒序
                              make t_shu COUNT ※
                              make t1_shu first ※
                              make t_rus [] make t_rus FPUT t1_shu t_rus make i_i 2
                              label lb2 make t1_shu ITEM i_i ※
                              make i_ii 1 label lb1 make t2_shu ITEM i_ii t_rus
                              IF t2_shu>t1_shu THEN [c插入t_rus i_ii t1_shu GO lb3] make i_ii i_ii+1
                              IF i_ii=i_i THEN [c插入t_rus 1 t1_shu GO lb3] GO lb1
                              label lb3 make i_i i_i+1 IF i_i>t_shu then [make ※ t_rus STOP] go lb2
                              END
                              ;※※※※※※※※※※※※※※※上面的3个函数是一个整体 ※※※※※※※※※※※※※※※
                              ;※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
                              ;※ 上面几个函数是一个整体 要把※改成具体的表的名称才能用 ※※※※※※
                              ;※ 对表的操作 ※※※※※※
                              ;※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
                              ;※※※※ 压栈 出栈 ※※※※※※※
                              TO y压※到栈※※
                              make ※※ FPUT ※ ※※
                              end
                              TO c出※自栈※※
                              make ※ FIRST ※※ make ※※ bf ※※
                              end
                              ;※※※※ 压栈 出栈 ※※※※※※※


                              70楼2016-12-18 22:55
                              收起回复