Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. local component = require("component")
  2. local sides = require("sides")
  3. local robot = require("robot")
  4. rawget(getmetatable(o) or {}, "__ev")
  5.  
  6. --[[local g = component.generator
  7. robot.select(2)
  8. g.untinsert()
  9. print(g.co())]]
  10. function turnRobot(turnedLeft)
  11. if turnedLeft == 1
  12. then
  13. robot.turnRight()
  14. while i < 3 do
  15. robot.swing(sides.front)
  16. robot.forward(1)
  17. end
  18. robot.turnRight()
  19. turnedleft = 0
  20.  
  21. elseif turnedLeft == 0
  22. then
  23. robot.turnLeft()
  24. while i < 3 do
  25. robot.swing(sides.front)
  26. robot.forward(1)
  27. end
  28. robot.turnLeft()
  29. turnedLeft = 1
  30. end
  31. return turnedleft;
  32. end
  33.  
  34. rmb = 0 -- Means Robot moved block
  35. turnedLeft = 0 -- Boolean that means at 1 that the robot turned left last 25 Blocks
  36.  
  37. for i = 200,1,-1 do
  38. --Check when the Robot has moved 12 Blocks
  39. if (rmb % 12 == 0)
  40. then print("Es ist durch 12 teilbar")
  41. end
  42. if (rmb % 25 == 0)
  43. then turnrobot
  44. print(turnedLeft)
  45. end
  46.  
  47.  
  48.  
  49. --[[end
  50. if (rmb == 175) then robot.turnRight()
  51. elseif (rmb == 172) then robot.turnRight()
  52. elseif (rmb == 147) then robot.turnLeft()
  53. elseif (rmb == 144) then robot.turnLeft()
  54. elseif (rmb == 119) then robot.turnRight()
  55. elseif (rmb == 116) then robot.turnRight()
  56. elseif (rmb == 91) then robot.turnLeft()
  57. elseif (rmb == 88) then robot.turnLeft()
  58. elseif (rmb == 63) then robot.turnRight()
  59. elseif (rmb == 60) then robot.turnRight()
  60. elseif (rmb == 35) then robot.turnLeft()
  61. elseif (rmb == 32) then robot.turnLeft()
  62. elseif (rmb == 7) then robot.turnRight()
  63. end]]
  64.  
  65. if robot.detect() == true
  66. then
  67. robot.swing(sides.front)
  68. robot.forward(1)
  69. print(rmb)
  70. else
  71. robot.forward(1)
  72. print(rmb)
  73. end
  74. rmb = rmb + 1
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement