From b09d14a6ec43301c39c97d52373c89ad2142240f Mon Sep 17 00:00:00 2001 From: Christian Lincoln Date: Wed, 1 Jul 2026 23:17:41 +0100 Subject: [PATCH] Upgraded commands; Added crude solver function, special nexus and minor changes --- main.lua | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/main.lua b/main.lua index 0b058a7..a3080f5 100644 --- a/main.lua +++ b/main.lua @@ -25,12 +25,13 @@ local function h(it) end local function s(it) - -- todo: use some sort of heuristic here like A* + -- todo: use some sort of heuristic here like in A* local options = {it} while true do - table.sort(branches,function(a,b) return h(a) > h(b) end) + -- order + table.sort(branches,function(a,b) return h(a) > h(b) end) for depends in pairs(it.class.implies) do - depends. + depends. end break end @@ -53,13 +54,13 @@ local n = setmetatable({},{ end }) -c.next = c() -c.in = {} +c.after = c() +c.inp = {} c.out = {} c.text = {} c.cookie = c() for char in ("abcdefghijklmnopqrstuvwxyz "):match(".") do - c.in[char] = c() + c.inp[char] = c() c.out[char] = c() end @@ -70,12 +71,12 @@ while true do local name,text = command:match("(%a*)%s*(.*)") if name == "cookie" then local cookie = n(c.cookie,I) - n(c.next,I,previous,cookie) + n(c.after,I,previous,cookie) previous = cookie else local mode - if name == "in" or name == "" then - mode = c.in + if name == "inp" or name == "" then + mode = c.inp elseif name == "out" then mode = c.out else @@ -84,7 +85,7 @@ while true do for char in text:match(".") do if mode[char] then local object = n(mode[char],I) - n(c.next,I,previous,object) + n(c.after,I,previous,object) previous = object end end