Upgraded commands; Added crude solver function, special nexus and minor changes

This commit is contained in:
2026-07-01 23:17:41 +01:00
parent 144d50fc03
commit b09d14a6ec
+11 -10
View File
@@ -25,12 +25,13 @@ local function h(it)
end end
local function s(it) 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} local options = {it}
while true do 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 for depends in pairs(it.class.implies) do
depends. depends.
end end
break break
end end
@@ -53,13 +54,13 @@ local n = setmetatable({},{
end end
}) })
c.next = c() c.after = c()
c.in = {} c.inp = {}
c.out = {} c.out = {}
c.text = {} c.text = {}
c.cookie = c() c.cookie = c()
for char in ("abcdefghijklmnopqrstuvwxyz "):match(".") do for char in ("abcdefghijklmnopqrstuvwxyz "):match(".") do
c.in[char] = c() c.inp[char] = c()
c.out[char] = c() c.out[char] = c()
end end
@@ -70,12 +71,12 @@ while true do
local name,text = command:match("(%a*)%s*(.*)") local name,text = command:match("(%a*)%s*(.*)")
if name == "cookie" then if name == "cookie" then
local cookie = n(c.cookie,I) local cookie = n(c.cookie,I)
n(c.next,I,previous,cookie) n(c.after,I,previous,cookie)
previous = cookie previous = cookie
else else
local mode local mode
if name == "in" or name == "" then if name == "inp" or name == "" then
mode = c.in mode = c.inp
elseif name == "out" then elseif name == "out" then
mode = c.out mode = c.out
else else
@@ -84,7 +85,7 @@ while true do
for char in text:match(".") do for char in text:match(".") do
if mode[char] then if mode[char] then
local object = n(mode[char],I) local object = n(mode[char],I)
n(c.next,I,previous,object) n(c.after,I,previous,object)
previous = object previous = object
end end
end end