From 946d96a6af91721323da19398335e237c219d425 Mon Sep 17 00:00:00 2001 From: Jacob Babor Date: Fri, 1 Dec 2023 12:14:25 -0600 Subject: [PATCH] Add conditional --- .../betterbreeder.lua | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/stoneblock-3-chicken-breeder/betterbreeder.lua b/stoneblock-3-chicken-breeder/betterbreeder.lua index b0b6f5a..cb8c22b 100644 --- a/stoneblock-3-chicken-breeder/betterbreeder.lua +++ b/stoneblock-3-chicken-breeder/betterbreeder.lua @@ -5,19 +5,25 @@ function placeBreeder() breeder = peripheral.wrap('top') -- First, we nab the new chicken in slot 1 turtle.select(1) - turtle.suckUp() - -- Then, we destroy the breeder - turtle.select(2) - turtle.digUp() - -- We are now in a position where we have: - -- 1: Good chicken - -- 2: Inferior chicken - -- 3: Seeds/second inferior chicken - -- 4: Breeder/seeds - -- 5: Null/breeder - -- In any case, discarding 1 item in slot 2 will eliminate poor genes - --turtle.select(2) -- Unnecessary due to previous instr - turtle.dropDown(1) + -- Check to see if this iteration obtained a new chicken + if turtle.suckUp() then + -- Then, we destroy the breeder + turtle.select(2) + turtle.digUp() + -- We are now in a position where we have: + -- 1: Good chicken + -- 2: Inferior chicken + -- 3: Seeds/second inferior chicken + -- 4: Breeder/seeds + -- 5: Null/breeder + -- In any case, discarding 1 item in slot 2 will eliminate poor genes + --turtle.select(2) -- Unnecessary due to previous instr + turtle.dropDown(1) + else + -- Just pop the breeder for consistency + turtle.select(2) + turtle.digUp() + end -- Now we re set-up the breeder selectItem('chickens:breeder') turtle.placeUp()