Disegna dei tratti consecutivi con colore e spessore casuale
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
GraphicsWindow.Height=GraphicsWindow.Width Turtle.Speed=10 SPAZIO =25 SPAZIO2=2*spazio xm=GraphicsWindow.Width -SPAZIO2 ym=GraphicsWindow.Height-SPAZIO2 While "true" x=Math.GetRandomNumber(xm)+SPAZIO y=Math.GetRandomNumber(ym)+SPAZIO GraphicsWindow.PenColor=GraphicsWindow.GetRandomColor() GraphicsWindow.PenWidth=Math.GetRandomNumber(10) Turtle.MoveTo(x,y) Program.Delay(500) EndWhile |
Disegna dei tratti staccati
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
... While "true" x1=Math.GetRandomNumber(xm)+SPAZIO y1=Math.GetRandomNumber(ym)+SPAZIO x2=Math.GetRandomNumber(xm)+SPAZIO y2=Math.GetRandomNumber(ym)+SPAZIO Turtle.PenUp() Turtle.MoveTo(x1,y1) GraphicsWindow.PenColor=GraphicsWindow.GetRandomColor() GraphicsWindow.PenWidth=Math.GetRandomNumber(10) Turtle.PenDown() Turtle.MoveTo(x2,y2) Program.Delay(500) EndWhile |
Per disegnare triangoli sono necessari
- 3 punti
- 6 coordinate
1 2 3 4 5 6 7 8 9 10 11 12 |
... x1=Math.GetRandomNumber(xm)+SPAZIO y1=Math.GetRandomNumber(ym)+SPAZIO x2=Math.GetRandomNumber(xm)+SPAZIO y2=Math.GetRandomNumber(ym)+SPAZIO x3=Math.GetRandomNumber(xm)+SPAZIO y3=Math.GetRandomNumber(ym)+SPAZIO ... Turtle.MoveTo(x2,y2) Turtle.MoveTo(x3,y3) Turtle.MoveTo(x1,y1) ... |
Rettangoli?
- 2 punti (vertici opposti)
- 4 coordinate
1 2 3 4 5 6 7 8 9 10 11 |
... x1=Math.GetRandomNumber(xm)+SPAZIO y1=Math.GetRandomNumber(ym)+SPAZIO x2=Math.GetRandomNumber(xm)+SPAZIO y2=Math.GetRandomNumber(ym)+SPAZIO ... Turtle.MoveTo(x1,y2) Turtle.MoveTo(x2,y2) Turtle.MoveTo(x2,y1) Turtle.MoveTo(x1,y1) ... |