Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,68 @@
|
|||
// Rosetta Code problem: http://rosettacode.org/wiki/Simple_turtle_graphics
|
||||
// Adapted from Python to Yabasic by Galileo, 01/2022
|
||||
|
||||
import turtle
|
||||
|
||||
sub rectang(width, height)
|
||||
local i
|
||||
|
||||
for i = 1 to 2
|
||||
move(height)
|
||||
turn(-90)
|
||||
move(width)
|
||||
turn(-90)
|
||||
next
|
||||
end sub
|
||||
|
||||
sub square(size)
|
||||
rectang(size, size)
|
||||
end sub
|
||||
|
||||
sub triang(size)
|
||||
local i
|
||||
|
||||
for i = 1 to 3
|
||||
move(size)
|
||||
turn(120)
|
||||
next
|
||||
end sub
|
||||
|
||||
sub house(size)
|
||||
turn(180)
|
||||
square(size)
|
||||
triang(size)
|
||||
turn(180)
|
||||
end sub
|
||||
|
||||
sub barchart(lst$, size)
|
||||
local t$(1), t(1), n, m, i, scale, width
|
||||
|
||||
n = token(lst$, t$())
|
||||
redim t(n)
|
||||
|
||||
for i = 1 to n
|
||||
t(i) = val(t$(i))
|
||||
if t(i) > m m = t(i)
|
||||
next
|
||||
|
||||
scale = size/m
|
||||
width = size/n
|
||||
for i = 1 to n
|
||||
rectang(t(i)*scale, width)
|
||||
pen(false)
|
||||
move(width)
|
||||
pen(true)
|
||||
next
|
||||
pen(false)
|
||||
move(-size)
|
||||
pen(true)
|
||||
end sub
|
||||
|
||||
startTurtle()
|
||||
color 255, 255, 255
|
||||
turn(90)
|
||||
house(150)
|
||||
pen(false)
|
||||
move(10)
|
||||
pen(true)
|
||||
barchart("0.5 0.333 2 1.3 0.5", 200)
|
||||
Loading…
Add table
Add a link
Reference in a new issue