Warning: session_start(): open(/var/lib/php/sessions/sess_prbe0gba6s00au5mkro8ukslvg, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
get("#349") -- table functions
taskID = input or "#2000060" -- change this to do another task
visualizerID = "#316" -- crop executor. don't change this
function findImage(taskID)
local title = getSnippetTitle(taskID)
return collectSnippetIDs(title)[1]
end
function findCoordinates(text)
for r in text:gmatch("%d+,%s*%d+,%s*%d+,%s*%d+") do
print("Coordinates: "..r)
table.insert(coordinates, r)
end
end
function collectSnippetIDs(text)
local ids = {}
for id in (text.." "):gmatch("(#%d+)[^0-9]") do
table.insert(ids, id)
end
return ids
end
coordinates = {}
-- get hints
refs = getTitleReferences(taskID)
for hintID in all(refs) do
hint = getSnippet(hintID)
print("Hint "..hintID..": "..hint)
findCoordinates(hint)
for id in all(collectSnippetIDs(hint)) do
print("snippet id: "..id)
findCoordinates(getSnippet(id))
end
end
print("Coordinates found: "..#coordinates)
if #coordinates == 0 then error "War wohl nix" end
print("Trying first set of coordinates.")
r = coordinates[1]
imageID = findImage(taskID)
result = "image "..imageID.." transform through "..visualizerID.." with input "..("%q"):format(r)
title = "An image generation expression for "..taskID
print("\n-- Result: "..title)
print(result)
return {type="nt", title=title, text=result}