Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local colors = {1, 5, nil, nil,
- 6, nil, nil, 3,
- 2, nil, nil, nil,
- nil, nil, 0, 4}
- --colors[a+1]
- local waitingRotate = false
- local numberOfAction = nil
- local function emptyFunction()
- end
- local function choose1()
- return turtle.turnLeft
- end
- local function choose2()
- return turtle.turnRight
- end
- local function choose3()
- a = math.random(2)
- if (a == 1) then return emptyFunction
- else return turtle.turnLeft
- end
- end
- local function choose4()
- a = math.random(2)
- if (a == 1) then return emptyFunction
- else return turtle.turnRight
- end
- end
- local function choose5()
- a = math.random(2)
- if (a == 1) then return turtle.turnLeft
- else return turtle.turnRight
- end
- end
- local actions = {choose1, choose2, choose3, choose4, choose5}
- while true do
- _, block = turtle.inspectDown()
- if (block.name == "minecraft:wool") then
- action = colors[block.metadata + 1]
- else action = nil;
- end
- if (action ~= nil) then
- if (action == 0) then
- write("Let`s go "..tostring(action).."\n")
- if (a ~= nil) then
- a()()
- end
- waitingRotate = false;
- elseif (action >= 1 and action <=5) then
- write("I need to go deeper "..tostring(action).."\n")
- a = actions[action]
- waitingRotate = true
- elseif (action == 6) then
- write("I need rotate "..tostring(action).."\n")
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- if (action == nil) then
- waitingRotate = false
- end
- turtle.forward();
- --sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement