adding turtle examples (#598)
This commit is contained in:
		@@ -68,6 +68,27 @@ Here are some fun programs for your @boardname@!
 | 
			
		||||
}]
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Turtle graphics
 | 
			
		||||
 | 
			
		||||
```codecard
 | 
			
		||||
[{
 | 
			
		||||
  "name": "Turtle Square",
 | 
			
		||||
  "description": "move in a square",
 | 
			
		||||
  "url":"/examples/turtle-square",
 | 
			
		||||
  "cardType": "example"
 | 
			
		||||
}, {
 | 
			
		||||
  "name": "Turtle Spiral",
 | 
			
		||||
  "description": "move in a spiral",
 | 
			
		||||
  "url":"/examples/turtle-spiral",
 | 
			
		||||
  "cardType": "example"  
 | 
			
		||||
}, {
 | 
			
		||||
  "name": "Turtle Scanner",
 | 
			
		||||
  "description": "scans the screen down",
 | 
			
		||||
  "url":"/examples/turtle-scanner",
 | 
			
		||||
  "cardType": "example"  
 | 
			
		||||
}]
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Actuators
 | 
			
		||||
 | 
			
		||||
```codecard
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										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