Advertisement
Guest User

Untitled

a guest
May 1st, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. -- !/bin/lua
  2. -- -*- coding: UTF-8 -*-
  3.  
  4. local r = require("robot")
  5. local s = require("sides")
  6. local io = require("io")
  7.  
  8. local size
  9. io.write("Please enter the size of your hole")
  10. io.flush()
  11. size = io.read()
  12.  
  13. -- Main loop
  14.  
  15. for j=1,size do
  16. for i=1,size do
  17. mine()
  18. end
  19. end
  20.  
  21. function mine()
  22. turnLeft(1)
  23. r.swing()
  24. turnRight(2)
  25. r.swing()
  26. r.swingUp()
  27. r.swingDown()
  28. turnLeft(1)
  29. r.swing()
  30. r.forward
  31. end
  32.  
  33. function turnLeft(x)
  34. for i=1, x do
  35. r.turnLeft()
  36. end
  37.  
  38. function turnRight(x)
  39. for i=1, x do
  40. r.turnRight()
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement