#1022 Minecraft Education

Zusammenfassung
Minecraft Education. Letzter Unterricht. Der 3D Drücker ist fertig und kann ein Bild ausdrücken.
Programm:
local function placeDown() while turtle.getItemCount() == 0 do print('No items in slot '..byte+1) sleep(1) end turtle.placeDown() end local tArgs = { ... } image = tArgs[1] file = fs.open(image,'rb') byte = file.read() local lnLen = 1 local lnCnt = 0 while byte ~= nil do if byte >= 48 and byte <= 57 then byte = byte - 48 turtle.select(byte + 1) placeDown() --turtle.placeDown() turtle.back() elseif byte >= 97 and byte <= 102 then byte = byte - 97 + 10 turtle.select(byte + 1) placeDown() --turtle.placeDown() turtle.back() elseif byte == 10 then turtle.turnRight() turtle.back() turtle.turnLeft() for i=1,(lnLen-1) do turtle.forward() end lnLen = 0 lnCnt = lnCnt + 1 end print(byte) byte = file.read() lnLen = lnLen + 1 end for i=1,(lnLen-1) do turtle.forward() end turtle.turnRight() for i=1,lnCnt do turtle.forward() end turtle.turnLeft() file.close()
Hausaufgabe