Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local robot = require("robot")
- local moving = true
- local moving2 = true
- local invPos = 1
- function verifyInv()
- if(robot.count(invPos) == 0) then
- invPos = invPos + 1
- if(invPos > (robot.inventorySize() - 1) or robot.count(invPos) == 0) then
- return false
- end
- robot.select(invPos)
- end
- return true
- end
- function replaceBlockForward()
- local check = verifyInv()
- if(check) then
- robot.swing()
- robot.place()
- end
- return check
- end
- function replaceBlockBeneath()
- local check = verifyInv()
- if(check) then
- robot.swingDown()
- robot.placeDown()
- end
- return check
- end
- function diveReplace()
- local check = true
- local moving2 = robot.down()
- if(moving2) then
- if(not replaceBlockBeneath()) then
- check = false
- end
- robot.up()
- end
- return check
- end
- while moving do
- for move=1,93 do
- moving = robot.forward()
- if(not moving) then
- break
- end
- end
- if(not moving) then
- break
- end
- -- Pierwszy klocek na scianie
- robot.turnRight()
- if(not replaceBlockForward()) then
- break
- end
- robot.turnLeft()
- moving = robot.forward()
- if(not moving) then
- break
- end
- moving = robot.down()
- if(not moving) then
- break
- end
- -- Drugi klocek na scianie
- robot.turnRight()
- if(not replaceBlockForward()) then
- break
- end
- robot.turnLeft()
- moving = robot.forward()
- if(not moving) then
- break
- end
- -- Probujemy zejsc nizej i postawic trzeci klocek na scianie nr 1 oraz klocek nizej
- moving2 = robot.down()
- if(moving2) then
- robot.turnRight()
- if(not replaceBlockForward()) then
- break
- end
- robot.turnLeft()
- if(not replaceBlockBeneath()) then
- break
- end
- robot.up()
- end
- -- Przechodzimy przez tory
- moving = robot.forward()
- if(not moving) then
- break
- end
- moving = robot.forward()
- if(not moving) then
- break
- end
- robot.turnLeft()
- if(not moving) then
- break
- end
- moving = robot.forward()
- if(not moving) then
- break
- end
- moving = robot.forward()
- if(not moving) then
- break
- end
- -- Kladziemy pierwszy na srodku
- moving = diveReplace()
- if(not moving) then
- break
- end
- robot.forward()
- robot.turnRight()
- robot.forward()
- moving = diveReplace()
- if(not moving) then
- break
- end
- robot.forward()
- robot.turnLeft()
- robot.forward()
- moving = diveReplace()
- if(not moving) then
- break
- end
- robot.forward()
- robot.forward()
- robot.turnRight()
- robot.forward()
- robot.forward()
- moving2 = robot.down()
- if(moving2) then
- if(not replaceBlockBeneath()) then
- break
- end
- robot.turnLeft()
- if(not replaceBlockForward()) then
- break
- end
- robot.turnLeft()
- robot.up()
- end
- robot.forward()
- robot.turnRight()
- if(not replaceBlockForward()) then
- break
- end
- robot.turnLeft()
- robot.forward()
- robot.up()
- robot.turnRight()
- if(not replaceBlockForward()) then
- break
- end
- robot.turnRight()
- robot.turnRight()
- for move=1,6 do
- moving = robot.forward()
- if(not moving) then
- break
- end
- end
- if(not moving) then
- break
- end
- robot.turnLeft()
- end
Advertisement
Add Comment
Please, Sign In to add comment