adding turtle examples (#598)
This commit is contained in:
23
docs/examples/turtle-scanner.md
Normal file
23
docs/examples/turtle-scanner.md
Normal file
@ -0,0 +1,23 @@
|
||||
# Turtle Scanner
|
||||
|
||||
The turtle keeps on the scanning the screen.
|
||||
|
||||
```blocks
|
||||
turtle.setPosition(0, 0)
|
||||
turtle.turnRight()
|
||||
turtle.setSpeed(20)
|
||||
basic.forever(() => {
|
||||
turtle.forward(4)
|
||||
turtle.turnRight()
|
||||
turtle.forward(1)
|
||||
turtle.turnRight()
|
||||
turtle.forward(4)
|
||||
turtle.turnLeft()
|
||||
turtle.forward(1)
|
||||
turtle.turnLeft()
|
||||
})
|
||||
```
|
||||
|
||||
```package
|
||||
microturtle=github:Microsoft/pxt-microturtle#master
|
||||
```
|
23
docs/examples/turtle-spiral.md
Normal file
23
docs/examples/turtle-spiral.md
Normal file
@ -0,0 +1,23 @@
|
||||
# Turtle Spiral
|
||||
|
||||
The turtle goes to the center back and forth.
|
||||
|
||||
```blocks
|
||||
let index = 0
|
||||
turtle.setPosition(0, 0)
|
||||
turtle.turnRight()
|
||||
basic.forever(() => {
|
||||
for (let index = 0; index <= 4; index++) {
|
||||
turtle.forward(4 - index)
|
||||
turtle.turnRight()
|
||||
}
|
||||
for (let index = 0; index <= 4; index++) {
|
||||
turtle.turnLeft()
|
||||
turtle.back(index)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
```package
|
||||
microturtle=github:Microsoft/pxt-microturtle#master
|
||||
```
|
17
docs/examples/turtle-square.md
Normal file
17
docs/examples/turtle-square.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Turtle Square
|
||||
|
||||
A turtle program that runs in a square.
|
||||
|
||||
```blocks
|
||||
turtle.setPosition(0, 0)
|
||||
turtle.turnRight()
|
||||
turtle.setSpeed(29)
|
||||
basic.forever(() => {
|
||||
turtle.forward(4)
|
||||
turtle.turnRight()
|
||||
})
|
||||
```
|
||||
|
||||
```package
|
||||
microturtle=github:Microsoft/pxt-microturtle#master
|
||||
```
|
Reference in New Issue
Block a user