Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

15
LINES

< > BotCompany Repo | #236 // Code golf loop (incomplete Lua code)

Lua code

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

Image recognition results

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: 908 / 215
Referenced in: #3000382 - Answer for ferdie (>> t = 1, f = 0)