Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
print("Hello World!")
dataT={}
line = " "
for y = 100,600,100 do
for x = 10,60,10 do
for z = 1,6 do
dataT[y+x+z] = "_"
end
end
end
W="W"
dataT[134] = W
dataT[234] = W
dataT[334] = W
dataT[333] = W
dataT[432] = W
dataT[434] = W
dataT[531] = W
dataT[534] = W
dataT[535] = W
dataT[536] = W
dataT[544] = W
dataT[554] = W
dataT[634] = W
dataT[636] = W
--compas = 0
--forward =
-- If compas = 0 +X, 1 +Z, 2 -X, 3 -Z
--
--Left = -X
--right = +X
--Up = +Y
cordinates = 134
compas = 0
harvest = 0
found = {left = false, right = false, front = false, back = false}
local function moveForward()
if compas == 0 then -- North +X
cordinates = cordinates + 10
elseif compas == 1 then -- East +Z
cordinates = cordinates + 1
elseif compas == 2 then -- south -X
cordinates = cordinates - 10
elseif compas == 3 then -- West -Z
cordinates = cordinates - 1
end
end
local function cutLimb(forward)
place = cordinates
for move=1,4 do
place = place+move*forward
if dataT[place+100] == "W" then -- if wood Up
dataT[place+100] = "U"
end
if dataT[place-100] == "W" then -- if wood Down
dataT[place-100] = "D"
end
if dataT[place+10] == "W" then -- if wood Front
dataT[place+10] = "F"
end
if dataT[place+1] == "W" then -- if wood right
dataT[place+1] = "R"
end
if dataT[place-1] == "W" then -- if wood Left
dataT[place-1] = "L"
end
end
end
local function findNcut()
if dataT[cordinates-10] == "W" then -- if wood Front
dataT[cordinates-10] = "N"
cutLimb(-10)
elseif dataT[cordinates+1] == "W" then -- if wood right
dataT[cordinates+1] = "R"
cutLimb(1)
elseif dataT[cordinates+10] == "W" then -- if wood Back
dataT[cordinates+10] = "B"
cutLimb(10)
elseif dataT[cordinates-1] == "W" then -- if wood Left
dataT[cordinates-1] = "L"
cutLimb(-1)
else
return
end
findNcut()
end
local function moveForward()
if compas == 0 then -- North +X
cordinates = cordinates + 10
elseif compas == 1 then -- East +Z
cordinates = cordinates + 1
elseif compas == 2 then -- south -X
cordinates = cordinates - 10
elseif compas == 3 then -- West -Z
cordinates = cordinates - 1
end
end
local function checkNcut()
if dataT[cordinates+100] == "W" then -- if wood Up
dataT[cordinates+100] = "U"
harvest = harvest + 1
found.up = true
end
if dataT[cordinates-100] == "W" then -- if wood Down
dataT[cordinates-100] = "D"
harvest = harvest + 1
found.down = true
end
if dataT[cordinates+10] == "W" then -- if wood Front
dataT[cordinates+10] = "F"
harvest = harvest + 1
found.back = true
print(cordinates)
end
if dataT[cordinates-10] == "W" then -- if wood Back
dataT[cordinates-10] = "B"
harvest = harvest + 1
found.front = true
end
if dataT[cordinates+1] == "W" then -- if wood right
dataT[cordinates+1] = "R"
harvest = harvest + 1
found.right = true
end
if dataT[cordinates-1] == "W" then -- if wood Left
dataT[cordinates-1] = "L"
harvest = harvest + 1
found.left = true
end
end
print ("start")
while dataT[cordinates+100] == "W" do
dataT[cordinates+100] = "0"
findNcut()
cordinates = cordinates + 100 -- move up
end
--lookUp = dataT[curLocal+100]
--lookDwn = dataT[curLocal-100]
--lookFwd = dataT[curLocal-1]
--lookLft = dataT[curLocal-10]
--lookRht =dataT[curLocal+10]
--Print results
for y = 600,100,-100 do
print("\nThis is layer "..y)
for x = 60,10,-10 do
for z = 1,6 do
if z > 1 then
line = line..dataT[y+x+z]
else
line = dataT[y+x+z]
end
end
print(line)
end
end
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more