Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - -- setup is turtle facing apiary, with a (large, maybe dimensional storage) chest beneath the turtle
 - -- another chest on top is used for produce and extra drones
 - -- Q0LaxCKb
 - -- gXa8k1tJ
 - -- fKC8kx5b
 - -- H0CppXue
 - -- QTRQHPhM
 - -- RwTbaqpP
 - local apiary = peripheral.wrap("front")
 - local chest = peripheral.wrap("bottom")
 - local maxDrones = 6
 - local minDrones = 3
 - bees = {}
 - stacks = {}
 - purebreedBanList = {} --some bees have too low of fertility
 - purebreedDroneCount = 0 --we detect that by counting before and after drone counts during purebreeding
 - purebreedBee = nil --i didnt save it between runs tho
 - shutdownMsg = nil
 - function addParent(parent, offspring)
 - if not bees[parent] then
 - bees[parent] = {
 - --name = parent,
 - score = 0,
 - mutateFrom = {}
 - }
 - end
 - end
 - function addOffspring(offspring, parentss)
 - if bees[offspring] then
 - for i, parents in ipairs(parentss) do
 - table.insert(bees[offspring].mutateFrom, parents)
 - end
 - else
 - bees[offspring] = {
 - score = 0,
 - mutateFrom = parentss
 - }
 - end
 - for i, parents in ipairs(parentss) do
 - for i, parent in ipairs(parents) do
 - addParent(parent, offspring)
 - end
 - end
 - end
 - -- produce combinations from 1 or 2 lists
 - function choose(list, list2)
 - local newList = {}
 - if list2 then
 - for i = 1, #list2 do
 - for j = 1, #list do
 - if list[j] ~= list[i] then
 - table.insert(newList, {list[j], list2[i]})
 - end
 - end
 - end
 - else
 - for i = 1, #list do
 - for j = i, #list do
 - if list[i] ~= list[j] then
 - table.insert(newList, {list[i], list[j]})
 - end
 - end
 - end
 - end
 - return newList
 - end
 - --bee list from Master Apiarist Database v3.1
 - --Forestry v2.3.0.7 (683)
 - --Extra Bees v1.8-dev2
 - --Magic Bees v2.1.7 (build 78)
 - hivebee = {"Forest", "Meadows", "Mystical", "Unusual", "Attuned", "Wintry", "Marshy", "Water", "Tropical", "Modest", "Sorcerous", "Rocky"}
 - addOffspring("Common", choose(hivebee))
 - addOffspring("Cultivated", choose({"Common"}, hivebee))
 - addOffspring("Noble", {{"Common", "Cultivated"}})
 - addOffspring("Majestic", {{"Noble", "Cultivated"}})
 - addOffspring("Imperial", {{"Noble", "Majestic"}})
 - addOffspring("Diligent", {{"Common", "Cultivated"}})
 - addOffspring("Unweary", {{"Diligent", "Cultivated"}})
 - addOffspring("Industrious", {{"Diligent", "Unweary"}})
 - addOffspring("Heroic", {{"Steadfast", "Valiant"}})
 - addOffspring("Sinister", choose({"Cultivated"}, {"Modest", "Tropical"}))
 - addOffspring("Fiendish", choose({"Sinister"}, {"Cultivated", "Modest", "Tropical"}))
 - addOffspring("Frugal", choose({"Modest"}, {"Sinister", "Fiendish"}))
 - addOffspring("Demonic", {{"Sinister", "Fiendish"}})
 - addOffspring("Austere", {{"Modest", "Frugal"}})
 - addOffspring("Exotic", {{"Austere", "Tropical"}})
 - addOffspring("Edenic", {{"Exotic", "Tropical"}})
 - addOffspring("Spectral", {{"Hermitic", "Ender"}})
 - addOffspring("Phantasmal", {{"Spectral", "Ender"}})
 - addOffspring("Icy", {{"Industrious", "Wintry"}})
 - addOffspring("Glacial", {{"Icy", "Wintry"}})
 - addOffspring("Vindictive", {{"Monastic", "Demonic"}})
 - addOffspring("Vengeful", choose({"Vindictive"}, {"Demonic", "Monastic"}))
 - addOffspring("Avenging", {{"Vengeful", "Vindictive"}})
 - addOffspring("Leporine", {{"Meadows", "Forest"}})
 - addOffspring("Merry", {{"Wintry", "Forest"}})
 - addOffspring("Tipsy", {{"Wintry", "Meadows"}})
 - addOffspring("Tricky", {{"Sinister", "Common"}})
 - addOffspring("Rural", {{"Meadows", "Diligent"}})
 - addOffspring("Secluded", {{"Monastic", "Austere"}})
 - addOffspring("Hermitic", {{"Monastic", "Secluded"}})
 - addOffspring("Arid", {{"Meadows", "Modest"}})
 - addOffspring("Barren", {{"Arid", "Common"}})
 - addOffspring("Desolate", {{"Arid", "Barren"}})
 - addOffspring("Decaying", {{"Desolate", "Modest"}})
 - addOffspring("Skeletal", {{"Desolate", "Frugal"}})
 - addOffspring("Creepy", {{"Desolate", "Austere"}})
 - addOffspring("Decomposing", {{"Gnawing", "Common"}})
 - addOffspring("Tolerant", {{"Rocky", "Diligent"}})
 - addOffspring("Robust", {{"Rocky", "Tolerant"}})
 - addOffspring("Resilient", {{"Imperial", "Robust"}})
 - addOffspring("Corroded", {{"Resilient", "Forest"}})
 - addOffspring("Tarnished", {{"Resilient", "Marshy"}})
 - addOffspring("Rusty", {{"Resilient", "Meadows"}})
 - addOffspring("Leaden", {{"Resilient", "Unweary"}})
 - addOffspring("Galvanized", {{"Tarnished", "Cultivated"}})
 - addOffspring("Impregnable", {{"Resilient", "Noble"}})
 - addOffspring("Invincible", {{"Resilient", "Ender"}})
 - addOffspring("Glittering", {{"Corroded", "Imperial"}})
 - addOffspring("Shining", {{"Rusty", "Imperial"}})
 - addOffspring("Valuable", {{"Glittering", "Shining"}})
 - addOffspring("Lapis", {{"Resilient", "Water"}})
 - addOffspring("Emerald", {{"Lapis", "Noble"}})
 - addOffspring("Ruby", {{"Emerald", "Austere"}})
 - addOffspring("Sapphire", {{"Emerald", "Ocean"}})
 - addOffspring("Diamond", {{"Lapis", "Imperial"}})
 - addOffspring("Unstable", {{"Austere", "Rocky"}})
 - addOffspring("Nuclear", {{"Unstable", "Rusty"}})
 - addOffspring("Radioactive", {{"Nuclear", "Glittering"}})
 - addOffspring("Ancient", {{"Noble", "Diligent"}})
 - addOffspring("Primeval", {{"Ancient", "Noble"}})
 - addOffspring("Prehistoric", {{"Primeval", "Majestic"}})
 - addOffspring("Relic", {{"Prehistoric", "Imperial"}})
 - addOffspring("Fossilised", {{"Primeval", "Growing"}})
 - addOffspring("Resinous", {{"Primeval", "Fungal"}})
 - addOffspring("Oily", {{"Primeval", "Ocean"}})
 - addOffspring("Distilled", {{"Oily", "Industrious"}})
 - addOffspring("Refined", {{"Oily", "Distilled"}})
 - addOffspring("Elastic", {{"Refined", "Resinous"}})
 - addOffspring("River", {{"Water", "Common"}})
 - addOffspring("Ocean", {{"Water", "Diligent"}})
 - addOffspring("Stained", {{"Ebony", "Ocean"}})
 - addOffspring("Growing", {{"Diligent", "Forest"}})
 - addOffspring("Thriving", {{"Growing", "Rural"}})
 - addOffspring("Blooming", {{"Thriving", "Growing"}})
 - addOffspring("Sweetened", {{"Valiant", "Diligent"}})
 - addOffspring("Sugary", {{"Sweetened", "Diligent"}})
 - addOffspring("Ripening", {{"Sugary", "Forest"}})
 - addOffspring("Fruity", {{"Ripening", "Rural"}})
 - addOffspring("Farmed", {{"Cultivated", "Rural"}})
 - addOffspring("Bovine", {{"Rural", "Water"}})
 - addOffspring("Caffeinated", {{"Tropical", "Rural"}})
 - addOffspring("Minty", {{"Tropical", "Farmed"}})
 - addOffspring("Damp", {{"Common", "Marshy"}})
 - addOffspring("Boggy", {{"Damp", "Marshy"}})
 - addOffspring("Fungal", {{"Boggy", "Damp"}})
 - addOffspring("Furious", {{"Embittered", "Sinister"}})
 - addOffspring("Volcanic", {{"Embittered", "Furious"}})
 - addOffspring("Malicious", {{"Sinister", "Tropical"}})
 - addOffspring("Infectious", {{"Malicious", "Tropical"}})
 - addOffspring("Virulent", {{"Malicious", "Infectious"}})
 - addOffspring("Viscous", {{"Water", "Exotic"}})
 - addOffspring("Glutinous", {{"Viscous", "Exotic"}})
 - addOffspring("Sticky", {{"Viscous", "Glutinous"}})
 - addOffspring("Corrosive", {{"Virulent", "Sticky"}})
 - addOffspring("Caustic", {{"Corrosive", "Fiendish"}})
 - addOffspring("Acidic", {{"Corrosive", "Caustic"}})
 - addOffspring("Excited", {{"Cultivated", "Valiant"}})
 - addOffspring("Energetic", {{"Excited", "Valiant"}})
 - addOffspring("Frigid", {{"Wintry", "Diligent"}})
 - addOffspring("Absolute", {{"Ocean", "Frigid"}})
 - addOffspring("Shadowed", {{"Tolerant", "Sinister"}})
 - addOffspring("Darkened", {{"Shadowed", "Embittered"}})
 - addOffspring("Abyssal", {{"Shadowed", "Darkened"}})
 - addOffspring("Maroon", {{"Forest", "Valiant"}})
 - addOffspring("Saffron", {{"Meadows", "Valiant"}})
 - addOffspring("Prussian", {{"Water", "Valiant"}})
 - addOffspring("Natural", {{"Tropical", "Valiant"}})
 - addOffspring("Ebony", {{"Rocky", "Valiant"}})
 - addOffspring("Bleached", {{"Wintry", "Valiant"}})
 - addOffspring("Sepia", {{"Marshy", "Valiant"}})
 - addOffspring("Amber", {{"Maroon", "Saffron"}})
 - addOffspring("Turquoise", {{"Natural", "Prussian"}})
 - addOffspring("Indigo", {{"Maroon", "Prussian"}})
 - addOffspring("Slate", {{"Ebony", "Bleached"}})
 - addOffspring("Azure", {{"Prussian", "Bleached"}})
 - addOffspring("Lavender", {{"Maroon", "Bleached"}})
 - addOffspring("Lime", {{"Natural", "Bleached"}})
 - addOffspring("Fuchsia", {{"Indigo", "Lavender"}})
 - addOffspring("Ashen", {{"Slate", "Bleached"}})
 - addOffspring("Celebratory", {{"Austere", "Excited"}})
 - addOffspring("Jaded", {{"Ender", "Relic"}})
 - addOffspring("Glowering", {{"Furious", "Excited"}})
 - addOffspring("Hazardous", {{"Austere", "Desolate"}})
 - addOffspring("Lustered", {{"Resilient", "Unweary"}})
 - addOffspring("Abnormal", {{"Secluded", "Ender"}})
 - addOffspring("Spatial", {{"Abnormal", "Hermitic"}})
 - addOffspring("Quantum", {{"Spatial", "Spectral"}})
 - addOffspring("Eldritch", choose({"Cultivated"}, {"Mystical", "Sorcerous", "Unusual", "Attuned"}))
 - addOffspring("Esoteric", {{"Cultivated", "Eldritch"}})
 - addOffspring("Mysterious", {{"Eldritch", "Esoteric"}})
 - addOffspring("Arcane", {{"Esoteric", "Mysterious"}})
 - addOffspring("Charmed", {{"Cultivated", "Eldritch"}})
 - addOffspring("Enchanted", {{"Eldritch", "Charmed"}})
 - addOffspring("Supernatural", {{"Charmed", "Enchanted"}})
 - addOffspring("Ethereal", {{"Arcane", "Supernatural"}})
 - addOffspring("Watery", {{"Supernatural", "Ethereal"}})
 - addOffspring("Earthen", {{"Supernatural", "Ethereal"}})
 - addOffspring("Firey", {{"Supernatural", "Ethereal"}})
 - addOffspring("Windy", {{"Supernatural", "Ethereal"}})
 - addOffspring("Pupil", {{"Monastic", "Arcane"}})
 - addOffspring("Scholarly", {{"Arcane", "Pupil"}})
 - addOffspring("Savant", {{"Pupil", "Scholarly"}})
 - addOffspring("Aware", {{"Ethereal", "Attuned"}})
 - addOffspring("Spirit", choose({"Aware"}, {"MystEtherealical", "Attuned"}))
 - addOffspring("Soul", {{"Aware", "Spirit"}})
 - addOffspring("Skulking", {{"Modest", "Eldritch"}})
 - addOffspring("Ghastly", {{"Skulking", "Ethereal"}})
 - addOffspring("Spidery", {{"Tropical", "Skulking"}})
 - addOffspring("Smouldering", {{"Skulking", "Hateful"}})
 - addOffspring("Timely", {{"Imperial", "Ethereal"}})
 - addOffspring("Lordly", {{"Imperial", "Timely"}})
 - addOffspring("Doctoral", {{"Timely", "Lordly"}})
 - addOffspring("Infernal", {{"Infernal", "ves"}})
 - addOffspring("Hateful", {{"Infernal", "Eldritch"}})
 - addOffspring("Spiteful", {{"Infernal", "Hateful"}})
 - addOffspring("Withering", {{"Demonic", "Spiteful"}})
 - addOffspring("Oblivion", {{"Oblivion", "ves"}})
 - addOffspring("Nameless", {{"Ethereal", "Oblivion"}})
 - addOffspring("Abandoned", {{"Oblivion", "Nameless"}})
 - addOffspring("Forlorn", {{"Nameless", "Abandoned"}})
 - addOffspring("Draconic", {{"Imperial", "Abandoned"}})
 - addOffspring("Ferrous", {{"Common", "Industrious"}})
 - addOffspring("Auric", {{"Minium", "Plumbum"}})
 - addOffspring("Cuprum", {{"Industrious", "Meadows"}})
 - addOffspring("Stannum", {{"Industrious", "Forest"}})
 - addOffspring("Argentum", {{"Imperial", "Modest"}})
 - addOffspring("Plumbum", {{"Stannum", "Common"}})
 - addOffspring("Aluminum", {{"Industrious", "Cultivated"}})
 - addOffspring("Ardite", {{"Industrious", "Infernal"}})
 - addOffspring("Cobalt", {{"Imperial", "Infernal"}})
 - addOffspring("Manyullyn", {{"Ardite", "Cobalt"}})
 - addOffspring("Diamandi", {{"Austere", "Auric"}})
 - addOffspring("Esmeraldi", {{"Austere", "Argentum"}})
 - addOffspring("Apatine", {{"Rural", "Cuprum"}})
 - addOffspring("Mutable", {{"Unusual", "Eldritch"}})
 - addOffspring("Transmuting", {{"Unusual", "Mutable"}})
 - addOffspring("Crumbling", {{"Unusual", "Mutable"}})
 - addOffspring("Invisible", {{"Mystical", "Mutable"}})
 - addOffspring("Aer", {{"Windy", "Windy"}})
 - addOffspring("Ignis", {{"Firey", "Firey"}})
 - addOffspring("Aqua", {{"Watery", "Watery"}})
 - addOffspring("Solum", {{"Earthen", "Earthen"}})
 - addOffspring("Ordered", {{"Ethereal", "Arcane"}})
 - addOffspring("Chaotic", {{"Ethereal", "Supernatural"}})
 - addOffspring("Brainy", {{"Skulking", "Pupil"}})
 - addOffspring("Batty", {{"Skulking", "Windy"}})
 - addOffspring("Poultry", {{"Common", "Skulking"}})
 - addOffspring("Beefy", {{"Common", "Skulking"}})
 - addOffspring("Porcine", {{"Common", "Skulking"}})
 - addOffspring("Minium", {{"Frugal", "Eldritch"}})
 - --find the highest level bee i own that is a parent to species (of type "Princess" or "Drone" if type ~= nil)
 - --returns parent, offspring, score
 - --offspring is the next step after parent
 - --score is the depth of the search
 - function findAvailableParent(species, score, type)
 - for i, stack in pairs(stacks) do
 - if stack.beeInfo.displayName == species then
 - if type then
 - if string.find(stack.name, type) then
 - return species, nil, score
 - end
 - else
 - return species, nil, score
 - end
 - end
 - end
 - local aScore, aParent, aOffspring
 - local beeScore = 99999
 - local beeParent = nil
 - local beeOffspring = nil
 - for i, parents in ipairs(bees[species].mutateFrom) do
 - aParent, aOffspring, aScore = findAvailableParent(parents[1], score + 1, type)
 - if aScore < beeScore then
 - beeScore = aScore
 - beeParent = aParent
 - beeOffspring = aOffspring
 - end
 - aParent, aOffspring, aScore = findAvailableParent(parents[2], score + 1, type)
 - if aScore < beeScore then
 - beeScore = aScore
 - beeParent = aParent
 - beeOffspring = aOffspring
 - end
 - end
 - if beeOffspring == nil then
 - beeOffspring = species
 - end
 - return beeParent, beeOffspring, beeScore
 - end
 - --finds a princess and drone of the given species if they exist
 - local function findSpecies(species)
 - local princessIndex = nil
 - local droneIndex = nil
 - for i, stack in pairs(stacks) do
 - if stack.beeInfo.displayName == species then
 - if string.find(stack.name, "Princess") then
 - princessIndex = i
 - end
 - if string.find(stack.name, "Drone") then
 - droneIndex = i
 - end
 - end
 - end
 - return princessIndex, droneIndex
 - end
 - --breed these two species, they must exists and have a breeding pair
 - local function breedSpecies(parent1, parent2)
 - local princess1 = nil
 - local princess2 = nil
 - local drone1 = nil
 - local drone2 = nil
 - princess1, drone1 = findSpecies(parent1)
 - princess2, drone2 = findSpecies(parent2)
 - if not (princess1 and drone2) then
 - princess1 = princess2
 - drone2 = drone1
 - end
 - print("Breeding " .. parent1 .. " with " .. parent2)
 - if princess1 and drone2 then
 - chest.pushItem("up", princess1, 1)
 - turtle.drop()
 - chest.pushItem("up", drone2, 1)
 - turtle.drop()
 - return true
 - end
 - return false
 - end
 - --finds the most common species of type Drone or Princess
 - local function findExtraBee(type, msg)
 - local counts = {}
 - local bestcount = 0
 - local bestspecies = nil
 - for i, stack in pairs(stacks) do
 - if string.find(stack.name, type) then
 - if counts[stack.beeInfo.displayName] then
 - counts[stack.beeInfo.displayName] = counts[stack.beeInfo.displayName] + stack.qty
 - else
 - counts[stack.beeInfo.displayName] = stack.qty
 - end
 - if counts[stack.beeInfo.displayName] > bestcount then
 - bestcount = counts[stack.beeInfo.displayName]
 - bestspecies = stack.beeInfo.displayName
 - end
 - end
 - end
 - if bestcount < 2 then
 - shutdownMsg = "Need more " .. type .. "s!";
 - else
 - if msg == "Used" then
 - print("Used Extra " .. bestspecies .. " " .. type)
 - end
 - end
 - return bestspecies, bestcount
 - end
 - --helper function used when testing for low fertility
 - local getTotalDroneCount()
 - stacks = chest.getAllStacks()
 - local count = 0
 - for i, stack in pairs(stacks) do
 - if string.find(stack.name, "Drone") then
 - count = count + 1
 - end
 - end
 - return count
 - end
 - --attempt to create a princess and minDrones of species, which i own one of
 - --returns true if already purebred, else begins a breeding cycle
 - local function purebreed(species)
 - local princessCount = 0
 - local droneCount = 0
 - --count how many i have
 - for i, stack in pairs(stacks) do
 - if stack.beeInfo.displayName == species then
 - if string.find(stack.name, "Princess") then
 - princessCount = princessCount + stack.qty
 - end
 - if string.find(stack.name, "Drone") then
 - droneCount = droneCount + stack.qty
 - end
 - end
 - end
 - if princessCount >= 1 and droneCount >= minDrones then
 - return true
 - end
 - print("Attempting to purebreed " .. species)
 - if princessCount >= 1 and droneCount >= 1 then
 - if purebreedBanList[species] then
 - return true
 - end
 - purebreedBee = species
 - purebreedDroneCount = getTotalDroneCount()
 - breedSpecies(species, species)
 - return false
 - end
 - --find something to breed it with, an available parent, or an extra bee
 - local parent1, offspring, score
 - if(princessCount >= 1) then
 - parent1, offspring, score = findAvailableParent(species, 0, "Drone")
 - if score == 99999 then
 - parent1, score = findExtraBee("Drone", "Used")
 - else
 - --the purebreeding code sometimes gets stuck on low fertility bees
 - local princess1, drone1 = findSpecies(parent1)
 - if princess1 and drone2 and not purebreed(parent1) then
 - return false
 - end
 - end
 - else
 - parent1, offspring, score = findAvailableParent(species, 0, "Princess")
 - if score == 99999 then
 - parent1, score = findExtraBee("Princess", "Used")
 - else
 - --local princess1, drone1 = findSpecies(parent1)
 - if princess1 and drone2 and not purebreed(parent1) then
 - return false
 - end
 - end
 - end
 - if shutdownMsg then
 - return false
 - end
 - breedSpecies(species, parent1)
 - return false
 - end
 - --the main breeding function
 - --uses findavailableparent, then tries to create the designated offspring
 - local function targetSpecies(species)
 - local parent1
 - local parent2 = nil
 - --find the highest level bee i have that is a parent to species
 - --offspring is the next step after parent on the way to species
 - local parent1, offspring, score = findAvailableParent(species, 0, nil)
 - if score == 0 then
 - --found species
 - return true
 - end
 - if score == 99999 then
 - shutdownMsg = "No available parents for " .. species
 - return false
 - end
 - print("Targeting Species " .. offspring)
 - local princess1, drone1 = findSpecies(parent1)
 - local princess2, drone2
 - --find which bee i need to breed parent1 with to get offspring, showing preference for bees that i own
 - for i, parents in ipairs(bees[offspring].mutateFrom) do
 - if parents[1] == parent1 then
 - princess2, drone2 = findSpecies(parents[2])
 - if (princess1 and drone2) or (princess2 and drone1) then
 - parent2 = parents[2]
 - break
 - end
 - if not parent2 then
 - parent2 = parents[2]
 - end
 - if princess2 or drone2 then
 - parent2 = parents[2]
 - end
 - end
 - if parents[2] == parent1 then
 - princess2, drone2 = findSpecies(parents[1])
 - if (princess1 and drone2) or (princess2 and drone1) then
 - parent2 = parents[1]
 - break
 - end
 - if not parent2 then
 - parent2 = parents[1]
 - end
 - if princess2 or drone2 then
 - parent2 = parents[1]
 - end
 - end
 - end
 - princess2, drone2 = findSpecies(parent2)
 - if (princess1 and drone2) or (princess2 and drone1) then
 - --i have both bees i need so breed it now
 - --the purebreeding code sometimes gets stuck on low fertility bees
 - if princess1 and drone1 and not purebreed(parent1) then
 - return false
 - end
 - if princess2 and drone2 and not purebreed(parent2) then
 - return false
 - end
 - breedSpecies(parent1, parent2)
 - return false
 - end
 - --i have the species but not princess or drone, so purebreed it
 - if princess2 or drone2 then
 - purebreed(parent2)
 - return false
 - end
 - --i dont have the species i need to breed with parent, so target it
 - targetSpecies(parent2)
 - return false
 - end
 - local function dropExtraDrones()
 - local species, count = findExtraBee("Drone", "Dropping")
 - shutdownMsg = nil
 - if count <= maxDrones then
 - return
 - end
 - for i, stack in pairs(stacks) do
 - if stack.beeInfo.displayName == species and string.find(stack.name, "Drone") then
 - chest.pushItem("up", i, 1)
 - turtle.dropUp()
 - count = count - 1
 - if count <= maxDrones then
 - return
 - end
 - end
 - end
 - end
 - local function dropExtraItems()
 - stacks = chest.getAllStacks()
 - for i, stack in pairs(stacks) do
 - if (not string.find(stack.name, "Drone")) and (not string.find(stack.name, "Princess")) then
 - chest.pushItem("up", i, stack.qty)
 - turtle.dropUp()
 - end
 - end
 - end
 - local function main(species)
 - for slot = 1, 16 do
 - if turtle.getItemCount(slot) > 0 then
 - turtle.select(slot)
 - turtle.dropDown()
 - end
 - end
 - turtle.select(1)
 - local apiarystacks
 - while(1) do
 - --test for breeding in progress
 - apiarystacks = apiary.getAllStacks()
 - while apiarystacks[1] do
 - sleep(1)
 - while(turtle.suck()) do
 - turtle.dropDown()
 - end
 - apiarystacks = apiary.getAllStacks()
 - end
 - --clear apiary
 - while(turtle.suck()) do
 - turtle.dropDown()
 - end
 - if purebreedBee then
 - if purebreedDroneCount == getTotalDroneCount() then
 - purebreedBanList[purebreedBee] = 1
 - end
 - purebreedBee = nil
 - end
 - dropExtraItems()
 - --get the list of all items in the chest
 - stacks = chest.getAllStacks()
 - if targetSpecies(species) then
 - if purebreed(species) then
 - shutdownMsg = "Breeding complete: " .. species
 - end
 - end
 - if(shutdownMsg) then
 - print(shutdownMsg)
 - break
 - end
 - dropExtraDrones()
 - sleep(1)
 - end
 - end
 - local species = ...
 - if species == nil then
 - print("Usage")
 - print(" programname species")
 - return
 - end
 - if bees[species] == nil then
 - print("Species does not exist in database")
 - end
 - main(species)
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment