Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function turnRobot(turnedLeft)
- movedBlocks = 0
- if (turnedLeft == true)
- then
- robot.turnRight()
- while(movedBlocks < 3) do
- robot.swing(sides.front)
- robot.forward(1)
- movedBlocks = movedBlocks + 1
- end
- robot.turnRight()
- turnedLeft = false
- end
- if (turnedLeft == false)
- then
- robot.turnLeft()
- while( movedBlocks < 3) do
- robot.swing(sides.front)
- robot.forward(1)
- end
- robot.turnLeft()
- turnedLeft = true
- end
- return turnedLeft;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement