Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x3 = 0
- yam = 0
- xam = 0
- zam = 0
- ybu = 0
- xbu = 0
- zbu = 0
- y3 = 0
- orientation = 0
- z3 = 0
- print("Longeur :")
- xbu = tostring(read())
- xbu = tonumber(xbu)
- print("Largeur :")
- --zbu = tostring(read())
- --zbu = tonumber(zbu)
- zbu = 4
- print("hauteur : ")
- ybu = tonumber(read())
- function afficheinfo()
- term.clear()
- print("X:"..x3)
- print("Y:"..y3)
- print("Z:"..z3)
- print(zta)
- print(zbu)
- print("orientation:"..orientation)
- end
- function Corientation(o)
- while orientation ~= o do
- turtle.turnLeft()
- orientation = orientation+1
- if orientation == 4 then
- orientation = 0
- end
- afficheinfo()
- end
- end
- function deplacementY(y2)
- yb = tonumber(y2)
- while yb ~= y3 do
- if yb < y3 then
- if not turtle.down() then
- turtle.digDown()
- else
- y3 = y3-1
- afficheinfo()
- end
- else
- if not turtle.up() then
- turtle.digUp()
- else
- y3 = y3+1
- afficheinfo()
- end
- end
- end
- end
- function deplacementZ(z2)
- if z3 > z2 then
- Corientation(1)
- else
- Corientation(3)
- end
- while z3 ~= z2 do
- if not turtle.forward() then
- turtle.dig()
- else
- if orientation == 3 then
- z3 = z3+1
- afficheinfo()
- elseif orientation == 1 then
- z3 = z3-1
- afficheinfo()
- end
- end
- end
- end
- function deplacementX(x2)
- if x3 > x2 then
- Corientation(2)
- else
- Corientation(0)
- end
- while x3 ~= x2 do
- if not turtle.forward() then
- turtle.dig()
- else
- print("h")
- afficheinfo()
- if orientation == 0 then
- x3 = x3+1
- afficheinfo()
- elseif orientation == 2 then
- x3 = x3-1
- afficheinfo()
- end
- end
- end
- end
- function deplacement(xa,ya,za)
- deplacementY(ya)
- deplacementX(xa)
- deplacementZ(za)
- end
- function vidage()
- XT = x3
- YT = y3
- ZT = z3
- deplacement(0,0,0)
- Corientation(2)
- for slot=1,15 do
- turtle.select(slot)
- while turtle.getItemCount(slot) > 0 do
- turtle.drop(turtle.getItemCount(slot))
- if turtle.getItemCount(slot) > 0 then
- sleep(0.5)
- end
- end
- end
- deplacement(XT,YT,ZT)
- end
- function minage()
- zr = false
- zta = zbu
- for i2 = 0, ybu do
- for i1 = 0, zbu do
- if x3 == 0 then
- deplacementX(xbu)
- else
- deplacementX(0)
- end
- if zr == true then
- zta = zta-1
- deplacementZ(zta)
- if zta >= 0 then
- zr = false
- end
- else
- deplacementZ(i1)
- end
- end
- deplacementY(i2)
- if zr == false then zr = true
- elseif zr == true then
- zr = false
- end
- end
- deplacement(0,0,0)
- Corientation(0)
- end
- --deplacementY(1)
- minage()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement