Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- local size = math.floor( tonumber(tArgs[1]))
- os.loadAPI("/lib/adt")
- function buildSlice(n)
- if n==nil then
- n=1
- end
- for j=1, n do
- adt.forward()
- adt.placeDown()
- end
- if #tArgs ~= 2 then
- print("Incorrect usage of program!")
- print("build <width> <length>")
- else
- local width = math.floor( tonumber(tArgs[1]) )
- local length = math.floor( tonumber(tArgs[2]) )
- local side = math.floor( width/2 )
- adt.turnLeft()
- adt.forward(side)
- adt.turnRight()
- adt.placeDown()
- for i = 1, width do
- buildSlice(length)
- if math.fmod(i,2) == 0 then
- adt.turnLeft()
- adt.forward()
- adt.turnLeft()
- else
- adt.turnRight()
- adt.forward()
- adt.turnRight()
- end
- adt.placeDown()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment