Profile


Name
Reset NC
ID
49613
Shared with
Public
Parent
None
Children
Created on
July 16, 2014 at 21:21 PM UTC
Updated on
July 16, 2014 at 21:21 PM UTC
Description

Unfreezes + reset CI, cuts and bands

Best for


Code


--Reset by Bruno Kestemont 16/07/2014 --Generic subroutine for cleanup on cancel or end of recipe --also includes uncut, and takes into account the cut bug --also good as a simple reset recipe, to clean up your puzzle after any recipe stop function uncut() -- new BK 15/05/2014 for i=1, structure.GetCount() do structure.DeleteCut(i) end end function cleanup () --[[this for subroutine (not used in Reset) start,stop,line,msg=err:find(":(%d+):%s()") err=err:sub(msg,#err) print('---') if err:find('Cancelled')~=nil then print("User stop.") else print("unexpected error detected.") print("Error line:", line) print("Error :", err) end ]]-- --this for Reset print ( "Cleaning up" ) behavior.SetClashImportance ( 1.0 ) --save.Quickload ( kOriginalStructureOrNewBest ) -- only in subroutine recentbest.Restore() for i=1, 100 do save.Quickload(i) end recentbest.Restore() uncut(seg) creditbest.Restore() --uncut() save.LoadSecondaryStructure() band.DeleteAll() freeze.UnfreezeAll() print("Unfrezzed + Cleaned CI, cuts and bands, ss") end cleanup() -- as stand alone recipe --xpcall ( MAIN , cleanup ) -- if subroutine

Comments


Bruno Kestemont Lv 1

After run, type undo several times in order to select your preferred solution.
This can be useful in evolver mode, in order to recover your best nearly evolved solution (with no cuts).