Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local r = require("robot")
- local f = r.forward
- local lt = r.turnLeft
- local rt = r.turnRight
- local ar = r.turnAround
- local use = r.use
- local sw = r.swing
- local swd = r.swingDown
- local dt = r.detect
- local dtD = r.detectDown
- local dn = r.down
- local up = r.up
- function fD()
- local key = false
- if(f()) then
- key = true
- else
- while(not(key)) do
- key = f()
- end
- end
- end -- func
- function dN()
- local key = false
- if(dn()) then
- key = true
- else
- while(not(key)) do
- key = dn()
- end
- end
- end -- func
- function swD()
- local _,detect = dtD()
- while(detect == "solid") do
- _,detect = dtD()
- swd()
- end
- end -- func
- function try()
- local _,detect = dt()
- while(detect == "solid") do
- _,detect = dt()
- sw()
- end
- fD()
- end -- func
- ----------------------------------------------
- print("Введите длину, ширину, глубину")
- print("копаемой зоны")
- long = io.read()
- width = io.read()
- high = io.read()
- for i = 1,high do
- if(i~=1) then
- swD() ar() dN()
- end
- for j = 1,width do
- if(j%2==1 and j~=1) then
- if(width%2==1) then
- rt() try() rt()
- else
- if(i%2==1) then
- rt() try() rt()
- else
- lt() try() lt()
- end
- end
- elseif(j%2==0) then
- if(width%2==1) then
- lt() try() lt()
- else
- if(i%2==1) then
- lt() try() lt()
- else
- rt() try() rt()
- end
- end
- end
- for k = 1,long-1 do
- try()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement