Simple turtle graphics: Difference between revisions

Content added Content deleted
m (→‎{{header|Julia}}: orientation)
m (→‎{{header|Julia}}: reposition)
Line 21: Line 21:
function house(🐢, x, y, siz)
function house(🐢, x, y, siz)
oldorientation = 🐢.orientation
oldorientation = 🐢.orientation
xpos, ypos = 🐢.xpos, 🐢.ypos
# house wall
# house wall
Reposition(🐢, x, y)
Reposition(🐢, x, y)
Line 45: Line 46:
Rectangle(🐢, windowwidth, windowheight)
Rectangle(🐢, windowwidth, windowheight)
Orientation(🐢, oldorientation)
Orientation(🐢, oldorientation)
Reposition(🐢, xpos, ypos)
end
end


function barchart(🐢, data, x, y, siz)
function barchart(🐢, data, x, y, siz)
oldorientation = 🐢.orientation
oldorientation = 🐢.orientation
xpos, ypos = 🐢.xpos, 🐢.ypos
maxdata = maximum(data)
maxdata = maximum(data)
# scale to fit within a square with sides `siz` and draw bars of chart
# scale to fit within a square with sides `siz` and draw bars of chart
Line 62: Line 65:
end
end
Orientation(🐢, oldorientation)
Orientation(🐢, oldorientation)
Reposition(🐢, xpos, ypos)
end
end