Back to Recipes Homepage
recipe picture
Recipe: SmartRebuild V3.41
Your rating: None Average: 5 (1 vote)
Used 630 times with an average impact of 1138 points.


Name: SmartRebuild V3.41
ID: 9345
Created on: Thu, 08/26/2010 - 07:23
Updated on: Thu, 08/26/2010 - 14:23

Now with two layers of testing. See script for details.

Best For


Joined: 09/18/2009
Groups: SETI.Germany
That's how the code does look like

-- lua script Smart Rebuild 3.x for FoldIt by Crashguard303
-- Performs a rebuild of a user specified selection (use new interface to make your selection!).

function SmartRebuild()
-- internal values: triesL1,tiesL2,iter,crunch

--clean up values:
if triesL1<1 then triesL1=1 end -- assure that we minimum make one try
if triesL2<1 then triesL2=1 end -- assure that we minimum make one try

if iter<1 then iter=1 end -- and one iteration

if crunch==nil then crunch=true end
if crunch==true then

print("Creating reference state...")
end -- if

reset_recent_best() -- set current puzzle state as recent best
local ScoreAtStart=get_score(true)
print(" Score now: ",ScoreAtStart)
quicksave(1) -- L1 saving

print("Running multiple rebuild...")

local tryL1
for tryL1=1,triesL1 do
if tryL1>1 then quickload(1) end
print ("L1 Pass ",tryL1,"/",triesL1)
local tryL2
for tryL2=1,triesL2 do -- perform loop for number of tries
print (" L2 Pass ",tryL2,"/",triesL2)


print("Score now: ",get_score(true))
end -- tryL2 loop
end -- tryL1 loop
restore_recent_best() -- fetch best rebuild result
local ScoreAtEnd=get_score(true)
print("Score at start: ",ScoreAtStart)
print("Score at end: ",ScoreAtEnd)
print("Difference: ",ScoreAtEnd-ScoreAtStart)
end -- function

-- user parameters:
triesL1=3 -- Number of passes L1, integer value >=1
-- Sets how often the puzzle is set back to initial/reference state
triesL2=6 -- Number of passes L2, integer value >=1
iter=3 -- Number of iterations per rebuild, integer value
crunch=true -- boolean value
-- If true, before checking multiple rebuilds, a single rebuild solution is created and saved,
-- so that there is a score reference (recommended)

-- Note!
-- If this is not your first run without changes in the puzzle, you can set this to false.

SmartRebuild() -- run script

Joined: 08/09/2010
New idea for "deep rebuild" and "deep rebuild nested"

I tried your script, unfortunately not great results so far. But the idea is really good. How about this for a new version I call "deep rebuild nested":

use raven's stabilise method in walkin rebuild for the rebuilds - sphered and iterative shake sidechains and wiggle backbone, and sphered blue fuse.

use your nesting method, but stabilise every single rebuild and compare global score. This requires that you save both rebuild poses and stabilised rebuild poses but I am sure you can figure it out. This script would obviously be much slower to run, but I think get superior results.

"deep rebuild" would be a user-friendly version which just returns the best of some number of stabilised rebuilds, but also saves to slot 3 the unstabilised rebuild pose of the best one, so that the user can try restoring slot 2 and running again to nest if desired.

Want to try?
Add to Cookbook!
To download recipes to your cookbook, you need to have the game client running.

Developed by: UW Center for Game Science, UW Institute for Protein Design, Northeastern University, Vanderbilt University Meiler Lab, UC Davis
Supported by: DARPA, NSF, NIH, HHMI, Amazon, Microsoft, Adobe, RosettaCommons