taskID = selectATask() verifier = getVerifierForTask(taskId) solution = shortestSolutionForTask(taskID) if not verifier(solution) then error 'Sanity check failed' end if verifier '' then error 'Sanity check failed (or problem is trivial)' end while shouldRun() do solution2 = shorten(solution) if solution2 == nil then break end if verifier(solution2) then solution = solution2 print('Shortened solution to '..#solution2..' chars') end end
test run test run with input 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
Recognizer | Recognition Result | Visualize | Recalc |
---|---|---|---|
#308 | 471 | [visualize] |
Snippet ID: | #236 |
Snippet name: | Code golf loop (incomplete Lua code) |
Eternal ID of this version: | #236/1 |
Text MD5: | b629a63aa5bf41ec0490ed5f0378125d |
Author: | stefan |
Category: | computation loops |
Type: | Lua code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2014-02-15 22:18:28 |
Source code size: | 471 bytes / 15 lines |
Pitched / IR pitched: | Yes / Yes |
Views / Downloads: | 979 / 234 |
Referenced in: | [show references] |