Advertisement
poboivin

Turn

Oct 3rd, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. tArgs = {...}
  2. direction = tArgs[1]
  3. if direction == 0 then
  4. if currentFacing == 1 then
  5. shell.run('TurnLeft',(1))
  6. elseif currentFacing == 2 then
  7. shell.run('TurnRight',(2))
  8. elseif currentFacing == 3 then
  9. shell.run('TurnRight',(1))
  10. end
  11. elseif direction == 1 then
  12. if currentFacing == 2 then
  13. shell.run('TurnLeft',(1))
  14. elseif currentFacing == 3 then
  15. shell.run('TurnRight',(2))
  16. elseif currentFacing == 0 then
  17. shell.run('TurnRight',(1))
  18. end
  19. elseif direction == 2 then
  20. if currentFacing == 3 then
  21. shell.run('TurnLeft',(1))
  22. elseif currentFacing == 0 then
  23. shell.run('TurnRight',(2))
  24. elseif currentFacing == 1 then
  25. shell.run('TurnRight',(1))
  26. end
  27.  
  28. else -- direction 3
  29. if currentFacing == 0 then
  30. shell.run('TurnLeft',(1))
  31. elseif currentFacing == 1 then
  32. shell.run('TurnRight',(2))
  33. elseif currentFacing == 2 then
  34. shell.run('TurnRight',(1))
  35. end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement