3 ms·
One of the best ways is to teach them the basics of Logo. to square forward 100 right 90 forward 100 right 90 forward 100 right 90 forward 100
by pmoriarty 5y ago
One of the best ways is to teach them the basics of Logo.
to square
forward 100
right 90
forward 100
right 90
forward 100
right 90
forward 100
end
is a square.[1][2]
Then you can do:
forward 100
square
forward 100
square
etc...
Any child can get this. I did when I was 10 years old, with a bunch of other pre-teens.
Got it right away and absolutely loved drawing various geometrical patterns.
Of course, Logo is based on Lisp, so you can go pretty deep with it.
[1] - Draw it for them as you explain it, or just show it directly on the computer using Logo and turtle graphics.
[2] - Pardon if my program has any bugs.. I'm doing this from memory.. haven't touched Logo in decades...
- siraben 5y agoThat code looks exactly like the LOGO-like language aimed towards children. I wrote during a hackathon[0]. But for compactness I forgo the newlines, so the language looks like this: △ n = [ ↻ 30, ↑ n, ↻ 120, ↑ n, ↻ 120, ↑ n, right ] When programming routines in Haskell: square :: Float -> Turtle () square n = do penDown moveForward n rotateTurtle 90 moveForward n rotateTurtle 90 moveForward n rotateTurtle 90 moveForward n rotateTurtle 90 penUp Recursion is forbidden and all loops are bounded. [0] https://github.com/siraben/vpl/blob/4b5d39cbf8d16a988218e62f9cca5110ab794c4c/src/VPLEval.hs#L102 https://github.com/siraben/vpl/blob/4b5d39cbf8d16a988218e62f...