Last active
June 15, 2018 20:34
-
-
Save sshilovsky/176f5fc9e187623c018060c3ccc4fe32 to your computer and use it in GitHub Desktop.
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
function sleep_until(alarm) | |
while alarm>computer.uptime() do | |
local timeout=alarm-computer.uptime() | |
computer.pullSignal(timeout) | |
end | |
end | |
while 1 do | |
sleep_until(math.min(next_breed,next_farm)) | |
if next_breed<next_farm then | |
breed() | |
next_breed=computer.uptime()+BREED_INTERVAL | |
else | |
farm() | |
next_farm=computer.uptime()+FARM_INTERVAL | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment