-- -- sa_watch.lua -- -- Watches every sim chamber that holds a model for ~45s, sampling the model's -- nbt hash every 3s, and reports how many times each chamber's hash CHANGED. -- Run on the CHAMBER RTU computer. -- -- sa_watch -- -- Interpretation: -- * a TRAINING chamber changes its hash many times (data still climbing) -- * if a SELF-AWARE model's chamber shows ~0 changes, its hash goes idle when -- maxed -> the heuristic is sound and the bug is just the "needs catalyst" -- guard, which I can fix. -- * if the SELF-AWARE chamber ALSO keeps changing, the hash is useless for -- detection and we need a different mechanism (I'll switch to a manual / -- button-driven eject). -- -- After it runs, tell me which chamber index (the _N in the peripheral name) is -- the SELF-AWARE one in-game, and its change count. -- local CHAMBER = "hostilenetworks:sim_chamber" local MODEL = "hostilenetworks:data_model" local CATALYST= "prediction_matrix" local SAMPLES = 15 local GAP = 3 local function modelInfo(p) local ok, list = pcall(p.list) if not ok or not list then return nil end local nbt, disp, cat = nil, nil, 0 for s, item in pairs(list) do if item.name and item.name:find(MODEL) then local ok2, det = pcall(p.getItemDetail, s) if ok2 and type(det) == "table" then nbt, disp = det.nbt, det.displayName end elseif item.name and item.name:find(CATALYST) then cat = cat + item.count end end return nbt, disp, cat end local chambers = {} for _, n in ipairs(peripheral.getNames()) do if peripheral.getType(n) == CHAMBER then local p = peripheral.wrap(n) local nbt, disp = modelInfo(p) if nbt then chambers[#chambers+1] = { name = n, p = p, disp = disp, last = nbt, changes = 0, minCat = math.huge, maxCat = 0 } end end end print("watching " .. #chambers .. " chambers with models for ~" .. (SAMPLES*GAP) .. "s ...") if #chambers == 0 then print("(load a model first)"); return end for _ = 1, SAMPLES do sleep(GAP) for _, c in ipairs(chambers) do local nbt, _, cat = modelInfo(c.p) if nbt and nbt ~= c.last then c.changes = c.changes + 1; c.last = nbt end if cat then c.minCat = math.min(c.minCat, cat); c.maxCat = math.max(c.maxCat, cat) end end write(".") end print("") local out = fs.open("sa_watch.txt", "w") local function w(s) out.write(s .. "\n"); print(s) end w("=== sa_watch (" .. (SAMPLES*GAP) .. "s, " .. SAMPLES .. " samples) ===") for _, c in ipairs(chambers) do w(string.format("%-28s %-20s changes=%2d/%d catalyst=%d..%d", c.name, tostring(c.disp), c.changes, SAMPLES-1, c.minCat == math.huge and 0 or c.minCat, c.maxCat)) end w("") w("changes ~= 0 -> hash goes idle (looks self-aware/done)") w("changes high -> still actively simulating") out.close() print("wrote sa_watch.txt")