-Nobody's turtle found exit from maze
-But there are some very good works (for example Bom Bloke's work)
while true do
turtle.dig()
turtle.forward()
end
edit: lol, nvm i saw the no breaking blocks rule now :P/>close though.edit: lol, nvm i saw the no breaking blocks rule now :P/>while true do turtle.dig() turtle.forward() end
while true do
if not turtle.forward() then
turtle.turnRight()
end
end
done. :)/>lol, use code tags to maintain those spaces :P/>xxx
x x
x xxxx
x <- turtle enters here
x xxxx
x x
xxx
Would make him just go back and forth though :P/>
without more details (and/or screenshot) of the maze my submission will beBut this maze will be 50 blocks wide, and theese programs will not working, so this will be challange, and the maze will be from bedrock, so the while true do turtle.dig() … Don't works!
while true do
if not turtle.forward() then
turtle.turnLeft()
end
end
while true do
if not turtle.forward() then
turtle.turnRight()
end
end
that's okay, they can just be spinning top Turtles :P/>Ha! None of these will win, because what Konlab didn't say, was that none of the turtles would actually have fuel!
local function refuel()
while true do
sleep(1)
if turtle.getFuelLevel() < math.floor( turtle.getFuelLimit / 3 ) then
turtle.refuel( 8 )
end
end
end
local function checkRight()
turtle.turnRight()
local block = turtle.detect()
turtle.turnLeft()
return block
end
local function main()
while true do
if turtle.detect() then
turtle.turnLeft()
turtle.forward()
elseif checkRight() then
turtle.forward()
end
end
end
parallel.waitForAny( main, refuel )
Tada, I made it out of the maze.
os.pullEvent = os.pullEventRaw
while true do
turtle.turnLeft()
rednet.broadcast("DID I WIN?!")
print("DID I WIN?!")
sleep(0)
end
Okay, here's mine :P/>/>os.pullEvent = os.pullEventRaw while true do turtle.turnLeft() rednet.broadcast("DID I WIN?!") print("DID I WIN?!") sleep(0) end
Okay, here's mine :P/>/>os.pullEvent = os.pullEventRaw while true do turtle.turnLeft() rednet.broadcast("DID I WIN?!") print("DID I WIN?!") sleep(0) end
You forgot to do rednet.open("right") :-P
while true do
if turtle.forward()==true then
turtle.turnRight()
if turtle.detect()==true then
function refuel()
while true do
sleep(1)
if turtle.getFuelLevel() < math.floor( turtle.getFuelLimit / 3 ) then
turtle.refuel( 8 )
end
end
end
local function checkRight()
turtle.turnRight()
local block = turtle.detect()
turtle.turnLeft()
return block
end
local function main()
while true do
if not turtle.detectUp() then
turtle.up()
turtle.up()
elseif turtle.detect() then
turtle.turnLeft()
turtle.forward()
elseif checkRight() then
turtle.forward()
elseif not turtle.detectDown() then
turtle.down()
turtle.down()
end
end
end
parallel.waitForAny( main, refuel )
I will create a rednet receiver :)/>
That wouldn't work! :P/>And, just in case going right is faster in this particular maze, I'll submit theoriginalbit's other suggestionwhile true do if not turtle.forward() then turtle.turnRight() end end
Although either of these can easily be fooled by a room with a single entry that isn't aligned with a corner of the room.
while true do
turtle.turnRight()
if turtle.detect() then
turtle.turnLeft()
end
turtle.forward()
end
:P/>It's like you just said "Reading? Screw that, imma just post my idea!":P/>while true do turtle.turnRight() if turtle.detect() then turtle.turnLeft() end turtle.forward() end
I hope so too :P/>I assumed he was attempting to follow the running joke. It surprised me that anyone mentioned that "let's follow a wall" fallacy at all, let alone wrote code to perform it. I'd rather think they were all joking. :unsure:/>
Will be 2 categories: 2D and 3D.I hope so too :P/>/>I assumed he was attempting to follow the running joke. It surprised me that anyone mentioned that "let's follow a wall" fallacy at all, let alone wrote code to perform it. I'd rather think they were all joking. :unsure:/>/>
Konlab, can you post a screenshot of the maze? :rolleyes:/>/>
while true do
if turtle.up() then
if turtle.forward() then
else
turtle.back()
else
turtle.down()
end
turtle.turnLeft()
a = math.random(1,2)
if a == 1 then
turtle.turnRight()
else
turtle.turnLeft()
end
end
Screenshots will be only for cube-maze.
I will create a rednet receiver.
I will give him 15 coal.
When will the competition?
In Juny.
And this is my code for 3D
Lol, Maybe it's something between those months x)
2.I don't know :P/>
stack={}
bt={}
stpos=0
dir=1 --1=up 2=right 3=down 4=left
xpos=1
ypos=1
turtle.select(1)
function rev()
if dir==1 then
return xpos,ypos-1
elseif dir==2 then
return xpos-1,ypos
elseif dir==3 then
return xpos,ypos+1
else
return xpos+1,ypos
end
end
function cdir()
if dir ~= 4 then
dir=dir+1
else
dir=1
end
end
function been()
local xo=0
local yo=0
if dir==1 then
--return xpos,ypos-1
yo=1
elseif dir==2 then
--return xpos-1,ypos
xo=1
elseif dir==3 then
--return xpos,ypos+1
yo=-1
else
--return xpos+1,ypos
xo=-1
end
for i=1,#bt do
if bt[i][1]==xo+xpos and bt[i][2]==yo+ypos then
return true
end
end
print("Wasnt at "..xo+xpos..","..yo+ypos)
return false
end
function open()
for i=1,4 do
turtle.turnRight()
cdir()
if not turtle.detect() and not been() then
return true
end
end
return false
end
function setDir(d)
if dir==1 and d==2 then
dir=d
turtle.turnRight()
elseif dir==1 and d==4 then
dir=d
turtle.turnLeft()
elseif dir==2 and d==1 then
dir=d
turtle.turnLeft()
elseif dir==2 and d==3 then
dir=d
turtle.turnRight()
elseif dir==3 and d==2 then
dir=d
turtle.turnLeft()
elseif dir==3 and d==4 then
dir=d
turtle.turnRight()
elseif dir==4 and d==3 then
dir=d
turtle.turnLeft()
elseif dir==4 and d==1 then
dir=d
turtle.turnRight()
end
end
function pullStack()
print("Stack Dir:"..stack[stpos][3])
if stack[stpos][3]~=dir then
setDir(stack[stpos][3])
end
turtle.back()
cdir()
cdir()
addPos()
xprev,yprev=rev()
table.insert(bt,{xprev,yprev})
print("Added "..xprev..","..yprev..","..dir)
cdir()
cdir()
stpos=stpos-1
print("Pulled from stack")
end
function addPos()
if dir==1 then
--return xpos,ypos-1
ypos=ypos+1
elseif dir==2 then
--return xpos-1,ypos
xpos=xpos+1
elseif dir==3 then
--return xpos,ypos+1
ypos=ypos-1
else
--return xpos+1,ypos
xpos=xpos-1
end
end
while not turtle.compareDown() do
if turtle.forward() and not been() then
stpos=stpos+1
addPos()
xprev,yprev=rev()
stack[stpos] = {xprev,yprev,dir}
table.insert(bt,{xprev,yprev})
print("Added "..xprev..","..yprev..","..dir)
else
comp=false
for i=1,4 do
turtle.turnRight()
cdir()
if not turtle.detect() and not been() then
comp=true
break
end
end
if comp==false then
repeat
pullStack()
until open()
end
end
end
this isn't the entire mazeand this is why it was important that you show us the maze prior. otherwise you get to design the maze in such a way where we won't escape.
That's my another turtle, there I written an another program until turtles tries to finish…
I guess you didn't try it. Though I can see a turtle sitting above the walls - I really don't know what to make of this…
So you're saying that if the turtle ever needs to do a 180, it'll instead give up? :unsure:/>