Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local x = 0
- local y = 0
- orientation = 0
- local z = 0
- print("Longeur :")
- --x = tonumber(read())
- print("Largeur :")
- z = tonumber(read())
- function Corientation(o)
- while orientation ~= o do
- turtle.turnLeft()
- orientation = orientation+1
- if orientation == 4 then
- orientation = 0
- end
- print(tonumber(orientation))
- end
- end
- function deplacement(x1,z1)
- x1 = tonumber(x1)
- z1 = tonumber(z1)
- while y ~= 0 do
- if not turtle.up() then
- turtle.digUp()
- turtle.up()
- y = y+1
- else
- turtle.up()
- y = y+1
- end
- end
- if x > x1 then
- Corientation(2)
- else
- Corientation(0)
- end
- while x ~= x1 do
- if not turtle.forward() then
- turtle.dig()
- turtle.forward()
- x = x+1
- else
- turtle.forward()
- x = x+1
- end
- if z > z1 then
- Corientation(1)
- else
- Corientation(3)
- end
- while z ~= z1 do
- if not turtle.forward() then
- turtle.dig()
- turtle.forward()
- z = z+1
- else
- turtle.forward()
- z = z+1
- end
- end
- end
- end
- function vidage()
- for i=0,x do
- while true do
- print("1")
- if orientation ~= 2 then
- turtle.turnLeft()
- orientation = orientation + 1
- else
- break
- end
- end
- end
- end
- deplacement(10,15)
- deplacement(0,0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement