Upgraded commands; Added crude solver function, special nexus and minor changes
This commit is contained in:
parent
144d50fc03
commit
b09d14a6ec
1 changed files with 11 additions and 10 deletions
21
main.lua
21
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue