Simple turtle graphics: Difference between revisions
Content added Content deleted
(Added XPL0 example.) |
(→{{header|XPL0}}: Moved turtle the proper way for bar graph.) |
||
Line 1,197: | Line 1,197: | ||
=={{header|XPL0}}== |
=={{header|XPL0}}== |
||
⚫ | |||
<syntaxhighlight lang "XPL0"> |
<syntaxhighlight lang "XPL0"> |
||
def ScrW=320, ScrH=200; |
def ScrW=320, ScrH=200; |
||
Line 1,233: | Line 1,232: | ||
proc BarGraph(List, Len, Size); |
proc BarGraph(List, Len, Size); |
||
real List; int Len; real Size; |
real List; int Len; real Size; |
||
real PosX0; |
|||
int N; |
int N; |
||
def BarWidth = 0.4; |
def BarWidth = 0.4; |
||
⚫ | |||
[PosX0:= PosX; |
|||
⚫ | |||
[Rectangle(Size*BarWidth, List(N)*Size); |
[Rectangle(Size*BarWidth, List(N)*Size); |
||
MoveTo(Size*BarWidth); |
MoveTo(Size*BarWidth); |
||
]; |
]; |
||
MoveTo(-Size*BarWidth*float(Len)); |
|||
PosX:= PosX0; |
|||
]; |
]; |
||
Line 1,270: | Line 1,267: | ||
House(80.0); |
House(80.0); |
||
Pen:= Up; MoveTo(10.0); Pen:= Down; |
Pen:= Up; MoveTo(10.0); Pen:= Down; |
||
BarGraph([0.5, 1.0/3.0, 2.0, 1.3, 0.5], 5, |
BarGraph([0.5, 1.0/3.0, 2.0, 1.3, 0.5], 5, 45.0); |
||
]</syntaxhighlight> |
]</syntaxhighlight> |
||
{{out}} |
|||
⚫ | |||
</br> |
|||
=={{header|Yabasic}}== |
=={{header|Yabasic}}== |