Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local sides = require("sides")
- local robot = require("robot")
- function turnRobot(turnedLeft)
- -- local turnedLeft = {}
- local 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
- elseif (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
- rmb = 1 -- Means Robot moved block
- turnedLeft = true -- Boolean that means at 1 that the robot turned left last 25 Blocks
- for i = 200,1,-1 do
- --Check when the Robot has moved 12 Blocks
- if (rmb % 12 == 0)
- then print("Es ist durch 12 teilbar")
- end
- if (rmb % 25 == 0)
- then turnedLeft = turnRobot(turnedLeft)
- print(turnedLeft)
- end
- if robot.detect() == true
- then
- robot.swing(sides.front)
- robot.forward(1)
- print(rmb)
- else
- robot.forward(1)
- print(rmb)
- end
- rmb = rmb + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement