//設定畫布大小 size 400 400 //使運算速度加快 fast //設定背景 paper 100 //設計一個實心圓形圖形 command circlepixels cx cy dx dy { line (cx+dx) (cy+dy) (cx+dx) (cy-dy) line (cx-dx) (cy+dy) (cx-dx) (cy-dy) line (cx-dy) (cy+dx) (cx+dy) (cy+dx) line (cx-dy) (cy-dx) (cx+dy) (cy-dx) } command circle cx cy radius { set x 0 set y radius set d (1-radius) //circlepixels cx cy x y // 707/1000 approximates square root of 0.5 = cos(45) repeat x 0 (radius*400/1000) { set tempd d smaller? tempd 1 { set d (d+(2*x)+30) } notsmaller? tempd 0 { set d (d+(2*(x-y))+50) set y (y-10) } circlepixels cx cy x y } }
//設定畫布大小 size 450 450 //設定背景 paper 10 12 1 //使運算速度加快 fast //利用時間控制線條顏色 repeat c 0 500 { repeat x 0 400 { pen 20 20 9 line 200 300 (100+x) x line 280 800 (170+x) x line 200 0 (10+x) x line 375 0 x x line 0 275 x x line 75 100 x x line 350 80 (50+x) x line 190 90 0 x line 60 60 x 500 line 130 30 600 (100+x) line 55 0 (100-x) 0 refresh } refresh } forever { Paper 100 1 1 Pen 10 set B 50 repeat A 0 100 { Same? A B { line A 0 A B } Notsame? A B { line A 100 A B } } } forever { Paper 100 10 1 Pen 5 set B 100 repeat A 0 100 { Same? A 30 { line 100 A A A } Notsame? A 30 { line A A A 100 } } }
. //設定畫布大小 size 400 400 //設定背景 paper 10 10 1 //使運算速度加快 fast //設計一個以中心點為座標的實心方形 command rects x y w h r g b { pen r g b repeat w1 (-w) (w) { pen r g b line (x+(w1/2)) (y-h/2) (x+(w1/2)) (y+h/2) line (x+(w1*170)) (y-h*8) (x-(w1/55)) (y-h*800) line (x-(w1/170)) (y-h/5) (x-(w1/50)) (y-h*90) line (x-(w1/3)) (y-h/3) (x-(w1*7)) (y-h/5) line (x+(w1*120)) (y-h*8) (x-(w1/55)) (y-h*100) line (x-(w1/70)) (y-h/2) (x-(w1/50)) (y-h*190) line (x-(w1/3)) (y-h/8) (x-(w1*7)) (y-h/5) } } forever { //按下滑鼠才畫 same? 100 { rects 20 30 } //按下鍵盤的c, 利用設定背景顏色來清除畫面 same? 100 { paper 10 } }