Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = nil
- y = nil
- z = 0
- function digHole()
- while z < h do
- turtle.digDown()
- turtle.down()
- z = z + 1
- end
- while z > 0 do
- turtle.digUp()
- turtle.up()
- z = z - 1
- end
- end
- function testRange()
- if math.sqrt(math.pow(x, 2) + math.pow(y, 2)) <= r then
- return true
- else
- return false
- end
- end
- function search()
- while y <= r do
- if testRange() then
- digHole()
- end
- while x < r do
- turtle.dig()
- turtle.forward()
- x = x + 1
- if testRange() then
- digHole()
- end
- end
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- y = y + 1
- if testRange() then
- digHole()
- end
- turtle.turnRight()
- while x > -r do
- turtle.dig()
- turtle.forward()
- x = x - 1
- if testRange() then
- digHole()
- end
- end
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- y = y + 1
- if testRange() then
- digHole()
- end
- turtle.turnLeft()
- end
- end
- print("+-------------------------------------+")
- print("| Circle Miner |")
- print("+-------------------------------------+")
- print("+-------------------------------------+")
- print("+-------------------------------------+")
- read()
- print("+-------------------------------------+")
- print("| Radius = ? |")
- print("+-------------------------------------+")
- r = tonumber(read())
- x = -r
- y = -r
- print("+-------------------------------------+")
- print("| Height = ? |")
- print("+-------------------------------------+")
- h = tonumber(read())
- search()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement