Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function square(size)
- n = 0
- size = size - 1
- for i = 0,size,1 do
- for i = 0,size,1 do
- turtle.digDown()
- turtle.forward()
- end
- n = n + 1
- if turtle.detect() then
- addM = false
- else
- addM = true
- end
- if n%2 == 0 then
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- if addM then
- turtle.forward()
- end
- else
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- if addM then
- turtle.forward()
- end
- end
- end
- if n%2 == 0 then
- turtle.turnLeft()
- for i = 0,size,1 do
- turtle.forward()
- end
- turtle.turnRight()
- for i = 0,size-1,1 do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- else
- turtle.turnRight()
- for i = 0,size,1 do
- turtle.forward()
- end
- turtle.turnLeft()
- for i = 0,size-1,1 do
- turtle.forward()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- while true do
- square(3)
- turtle.down()
- sleep(0)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement