Icon representing a recipe

Recipe: Breathing Bands 1.1

created by lupussapien

Profile


Name
Breathing Bands 1.1
ID
102392
Shared with
Public
Parent
None
Children
Created on
June 16, 2017 at 21:47 PM UTC
Updated on
June 16, 2017 at 21:47 PM UTC
Description

Band the protein first. Each band in turn is then contracted and expanded within given limits, with shakes in between. The step size of the change in length is configurable.

May yield points early to mid game. Large step size good for early on.

Best for


Code


-- Version 1.1 -- Each band in turn is contracted and expanded with shakes in between -- May gain points early to mid game -- Added dialog with sliders bandstrength=5 factor=0.8 stepsize=0.8 shrink_factor_percent=80 expand_factor_percent=120 wiggle_time = 4 dlg = dialog.CreateDialog("Breathing Bands 1.1") dlg.stepsize = dialog.AddSlider("Step Size", stepsize, 0.1, 2, 1) dlg.shrink_factor_percent = dialog.AddSlider("Shrink Factor %", shrink_factor_percent, 25, 99, 0) dlg.expand_factor_percent = dialog.AddSlider("Expand Factor %", expand_factor_percent, 100, 200, 0) dlg.wiggle_time = dialog.AddSlider("Wiggle Time", wiggle_time, 1 ,15, 0) dlg.ok = dialog.AddButton("OK", 1) dlg.cancel = dialog.AddButton("Cancel", 0) if dialog.Show(dlg) > 0 then stepsize = dlg.stepsize.value shrink_factor = dlg.shrink_factor_percent.value/100 expand_factor = dlg.expand_factor_percent.value/100 wiggle_time = dlg.wiggle_time.value else print("Dialog cancelled") return 0 end for the_band = 1,band.GetCount() do band.SetStrength(the_band,bandstrength) band.SetGoalLength(the_band,band.GetLength(the_band)) end recentbest.Save() repeat recent_best = recentbest.GetScore()+0.1 for the_band = 1,band.GetCount() do print("Shrinking Band:",the_band) start_length = band.GetLength(the_band) for band_length = start_length,start_length*shrink_factor,-stepsize do band.SetGoalLength(the_band,band_length) --structure.MutateSidechainsAll(1) structure.WiggleAll(wiggle_time,true,true) structure.ShakeSidechainsAll(1) end print("Expanding Band:",the_band) for band_length = start_length*factor,start_length,stepsize do band.SetGoalLength(the_band,band_length) --structure.MutateSidechainsAll(1) structure.WiggleAll(wiggle_time,true,true) structure.ShakeSidechainsAll(1) end recentbest.Restore() structure.MutateSidechainsAll(1) structure.WiggleAll(4,true,true) structure.ShakeSidechainsAll(1) print("Expanding Band:",the_band) start_length = band.GetLength(the_band) for band_length = start_length,start_length/factor,stepsize do band.SetGoalLength(the_band,band_length) --structure.MutateSidechainsAll(1) structure.WiggleAll(wiggle_time,true,true) structure.ShakeSidechainsAll(1) end print("Shrinking Band:",the_band) for band_length = start_length*expand_factor,start_length,-stepsize do band.SetGoalLength(the_band,band_length) --structure.MutateSidechainsAll(1) structure.WiggleAll(wiggle_time,true,true) structure.ShakeSidechainsAll(1) end recentbest.Restore() --structure.MutateSidechainsAll(1) structure.WiggleAll(wiggle_time,true,true) structure.ShakeSidechainsAll(4) end until recentbest.GetScore() < recent_best

Comments