To start, I'm building a system that using rednet and turtles will draw a map or block placement diagram. Here's my code:


term.clear()
term.setCursorPos(1,1)
print("Map Finder v0.1")
rednet.open("right")
block={}
i=0
t=0
while(i<3) do
thereIsABlock=turtle.detect()
if(thereIsABlock) then
bool=1
i=i+1
block[i] = bool
turtle.turnLeft()
if(i>3) then
  return
end
else
bool=0
i=i+1
block[i] = bool
turtle.turnLeft()
if(i>3) then
  return
end
end
end

while(t<3) do
print(block[t])
t=t+1
end



My problem with this is it only turns 3 times and does some weird stuff with the array and the values are not what they are meant to be.

Thanks in advance, dvd604