Untitled

a guest
May 19th, 2019
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. local tArgs= { ... }
2. local mode = tArgs[2]
3.
4. local patterns = {"322322,333332,322222,222222,", "233322,322232,233322,222222,"}
5.
6. local traversed = 0
7.
8. turtle.select(1)
9. turtle.refuel()
10.
11.
12. function moveBack()
13. while traversed > 0 do
14. traversed = traversed - 1
15. if mode == "x" then
16. turtle.forward()
17. else
18. turtle.down()
19. end
20. end
21. end
22.
23. function placeMove(c, n)
24. if n ~= "," then
25. traversed = traversed + 1
26. if mode == "x" then
27. turtle.back()
28. else
29. turtle.up()
30. end
31. else
32. if mode == "x" then
33. turtle.turnRight()
34. turtle.back()
35. else
36. turtle.back()
37. end
38. end
39.
40. turtle.select(tonumber(c))
41. while turtle.getItemCount() == 0 and turtle.getSelectedSlot() < 12 do
42. turtle.select(turtle.getSelectedSlot() + 2)
43. end
44.
45. if n ~= "," then
46. if mode == "x" then
47. turtle.place()
48. else
49. turtle.placeDown()
50. end
51. else
52. if mode == "x" then
53. turtle.place()
54. turtle.turnLeft()
55. else
56. turtle.place()
57. end
58.
59. end
60.
61. end
62.
63. function executeCommand(c, n)
64. if c == "," then
65. moveBack()
66. else
67. placeMove(c, n)
68. end
69. end
70.
71. function drawLetter()
72. local rand = math.floor(math.random()+.5)
73. local pattern = patterns[rand + 1]
74. for i = 1, #pattern do
75. local c = pattern:sub(i,i)
76. local n = pattern:sub(i+1, i+1)
77. executeCommand(c, n)
78. end
79. end
80.
81. if mode == "x" then
82. turtle.turnLeft()
83. end
84.
85. local numLetters = tonumber(tArgs[1])
86. for i = 1, numLetters do
87. drawLetter()
88. end
89.
90. if mode == "x" then
91. turtle.turnRight()
92. end
RAW Paste Data