52 lines
875 B
Plaintext
52 lines
875 B
Plaintext
to rectangle :width :height
|
|
repeat 2 [
|
|
forward :height
|
|
left 90
|
|
forward :width
|
|
left 90 ]
|
|
end
|
|
|
|
to square :size
|
|
rectangle size size
|
|
end
|
|
|
|
to triangle :size
|
|
repeat 3 [
|
|
forward size
|
|
right 120 ]
|
|
end
|
|
|
|
to house :size
|
|
left 90
|
|
square size
|
|
triangle size
|
|
right 90
|
|
end
|
|
|
|
to max :lst
|
|
if equalp count lst 1 [ output first lst ]
|
|
make "x max butfirst lst
|
|
if x > first lst [ output x ]
|
|
output first lst
|
|
end
|
|
|
|
to barchart :lst :size
|
|
right 90
|
|
if emptyp lst [ stop ]
|
|
make "scale size / (max lst)
|
|
make "width size / count lst
|
|
foreach lst [
|
|
rectangle ? * scale width
|
|
forward width ]
|
|
back size
|
|
left 90
|
|
end
|
|
|
|
clearscreen hideturtle
|
|
house 150
|
|
penup
|
|
right 90 forward 10 left 90
|
|
pendown
|
|
barchart [ 0.5 0.33333 2 1.3 0.5 ] 200
|
|
left 90 back 10 right 90
|