Last active
October 4, 2015 13:37
-
-
Save TomyLobo/8a38d331436b4173db58 to your computer and use it in GitHub Desktop.
ComputerCraft turtle to patrol a rectangular area delimited by obsidian blocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shell.run('clear') | |
print("Please put obsidian in Slot 1 and mark the corners with obsidian.") | |
print("Go clockwise? (y/N)") | |
local clockwise = io.read():upper() == "Y" | |
local obsidian = 1 | |
print("Going "..(clockwise and "clockwise" or "counter-clockwise")..".") | |
while true do | |
turtle.select(obsidian) | |
repeat | |
for i = 1, 3 do | |
turtle.attack() | |
turtle.attackUp() | |
end | |
turtle.forward() | |
until turtle.compareDown() | |
if clockwise then | |
turtle.turnRight() | |
else | |
turtle.turnLeft() | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment