--- /dev/null
+-- setup:
+-- equip weak automata
+-- place in front of coal/shear chest, facing it
+
+-- refuel, grab shears (keep two at all times)
+-- harvest
+-- offload
+-- index
+-- repeat
+
+local shears =
+ { "alloyed:steel_shears"
+ , "minecraft:shears"
+ }
+
+-- return positions of shears in inventory
+-- might not be useful if countShears and selectShears is implemented
+-- local locateShears = function()
+-- local t = {}
+-- for i = 1, 16 do
+-- local item = turtle.getItemDetail(i)
+-- if item then
+-- for _,name in pairs(shears) do
+-- if item.name == name then
+-- table.insert(t, i)
+-- end
+-- end
+-- end
+-- end
+-- end
+
+-- find : list of item names -> index | nil
+-- returns the first inventory index containing an item from list t
+-- if no item is found, returns nil
+local find = function(t)
+ for i = 1, 16 do
+ print("looking in", i)
+ local item = turtle.getItemDetail(i)
+ if item then
+ for _,name in pairs(t) do
+ print("comparing", name, item.name)
+ if item.name == name then
+ return i
+ end
+ end
+ end
+ end
+ return nil
+end
+
+-- count : list of item names -> count
+local count = function(t)
+ local c = 0
+ for i = 1, 16 do
+ local item = turtle.getItemDetail(i)
+ if item then
+ for _, name in pairs(t) do
+ if item.name == name then
+ count = count + 1
+ break
+ end
+ end
+ end
+ end
+end
+
+-- select shears in inventory if not already selected.
+-- returns bool. false means no shears in inventory.
+-- local selectShears = function()
+-- if not turtle.getItemDetail() then
+-- for i = 1, 16 do
+-- if item and (item.name == "minecraft:shears" or item.name == "alloyed:steel_shears")
+-- (and item
+
+
+
+-- local shear = function()
+-- selectShears()
+-- local collect = function()
+-- a