Profile
Name: |
SmartRebuild V3.4 |
ID: |
9342 |
Created on: |
Thu, 08/26/2010 - 06:17 |
Updated on: |
Thu, 08/26/2010 - 13:17 |
Description: |
Now with two layers of testing.
See script for details. |
Best For
Comments
|
| | |
|
Want to try?
Add to Cookbook!
To download recipes to your cookbook, you need to have the game client running.
| |
| | |
| | |
|
-- 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!).
-- Default is 10 passes and no score threshold, so the first try is always stored as refrence for the other attempts.
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...")
do_local_rebuild(iter)
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)
do_local_rebuild(iter)
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