View difference between Paste ID: CAC2wBJ1 and u5TH4iDB
SHOW: | | - or go back to the newest paste.
1
t = turtle
2
3
function distanceInput()
4
	print("Input Distance")
5
	num = io.read()
6
	num = tonumber(num)
7
	return num
8
end
9
function fuel(distance)
10
	t.refuel()
11
end
12
function hole(distance)
13
	while distance > 0 do
14
		if t.detectDown() then
15
			t.digDown()
16
			t.down()
17
		else
18
			t.down()
19
		end
20
	distance = distance - 1
21
	end
22
end
23-
function modulo(tile)
23+
24-
	while tile > 8 do
24+
25-
		tile = tile - 8
25+
26
		t.forward()
27-
	print("Currently at tile: ", tile)
27+
28-
	return tile
28+
29
	end
30-
function turn(num)
30+
31-
	while num > 0 do
31+
function turn()
32-
		t.turnRight()
32+
33-
		num = num - 1
33+
34
function mineLayer()
35
	num = 3
36-
function turnAround()
36+
	if mark then
37-
	t.turnLeft()
37+
		while num > 0 do
38-
	t.turnLeft()
38+
			dforward()
39
			turn()
40-
function dleft()
40+
			dforward()
41-
	t.turnLeft()
41+
			num = num - 1
42-
	print("Left")
42+
43
		dforward()
44
		turn()
45
		t.digUp()
46
		t.up()
47
	else
48
		while num > 0 do
49
			dforward()
50
			dforward()
51-
function dright()
51+
			turn()
52
			num = num - 1
53-
	print("Right")
53+
54
		dforward()
55
		t.digUp()
56
		t.up()
57
	end
58
end
59
function mine(distance)
60-
	t.turnLeft()
60+
	mark = true
61
	dforward()
62-
function dback()
62+
	turn()
63-
	turnAround()
63+
64-
	print("Backward")
64+
		mineLayer(mark)
65
		distance = distance - 1
66
		mark = !mark
67
	end
68
end
69
function spiral()
70
	distance = distanceInput()
71-
	turnAround()
71+
72
	print("3x3 Spiral Initiated; No further input required")
73
	hole(distance)
74-
	print("Forward")
74+
75
end
76
77
spiral()