38 lines
1.2 KiB
Plaintext
38 lines
1.2 KiB
Plaintext
|
& Lesson 1: The World of the Turtle
|
||
|
& Ludus is a Logo: it leads with turtle graphics
|
||
|
& There are two panes on the right:
|
||
|
& * the turtle
|
||
|
& * the console
|
||
|
|
||
|
& You saw the console in Lesson 0: Hello World!
|
||
|
|
||
|
& `print!`ing things is very useful; remember you can do that.
|
||
|
|
||
|
& Now, we're going to give the turtle some functions.
|
||
|
|
||
|
forward! (100)
|
||
|
|
||
|
& let's dissect that
|
||
|
|
||
|
& forward! (100)
|
||
|
& ^^^^^^^^ `forward!` is is the name of the function
|
||
|
& ^^^^ `100` is how far the turtle should walk
|
||
|
& (...) notice that we have to put 100 in parens
|
||
|
|
||
|
& Uncomment the line below, and re-run the script:
|
||
|
& right! (0.25)
|
||
|
|
||
|
& right! (0.25)
|
||
|
& ^^^^^^ `right!` is the name of this function
|
||
|
& ^^^^ 0.25 is how far the turtle should turn
|
||
|
& (....) notice again, we put the amount in parens
|
||
|
& What is the unit of 0.25?
|
||
|
|
||
|
& Try out some other turtle functions. Here are a few:
|
||
|
& `left!`, `back!`, `penup!`, `pendown!`, `pencolor!`, `penwidth!`
|
||
|
& `home!`
|
||
|
|
||
|
& Note they all end with `!`. What happens if you forget the bang?
|
||
|
& There are abbreviations: `fd!`, `rt!`, `lt!`, `bk!`, etc.
|
||
|
& The turtle graphics functions (and abbreviations!) are listed at https://alea.ludus.dev/twc/ludus/src/branch/main/prelude.md#turtle-graphics
|