Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local m = peripheral.find "modem"
- local function log(base, n)
- return math.log(n) / math.log(base)
- end
- local function ID_is_cool(ID)
- for i = 2, 20 do
- local x = log(i, ID)
- if math.floor(x) == x then return true end
- end
- return false
- end
- if turtle then
- m.open(0)
- while true do
- turtle.dig()
- turtle.place()
- peripheral.call("front", "turnOn")
- local _, _, _, _, message = os.pullEvent "modem_message"
- print(message)
- if ID_is_cool(message) then
- os.shutdown()
- end
- sleep(2)
- end
- else
- local f = fs.open("test", "w")
- f.write "Hi"
- f.close()
- fs.delete "test"
- m.transmit(0, 0, os.getComputerID())
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement