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}
test run test run with input produce a snippet download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #529 |
Snippet name: | Extraction task solver (on example task: #2000060) |
Eternal ID of this version: | #529/1 |
Text MD5: | 42dc052ff6aa01cba04227e3fac9a996 |
Author: | stefan |
Category: | |
Type: | Lua code - Snippet producer |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-03-14 01:25:32 |
Source code size: | 1363 bytes / 56 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 782 / 196 |
Referenced in: | [show references] |