ChristianK Lv 1
Is it possible to use function such as math.abs and math.random in the cookbook?
If so, how do I import them?
Is it possible to use function such as math.abs and math.random in the cookbook?
If so, how do I import them?
They are not currently available, however, that functionality may be added in the future.
As long, as they are not available, I can give you a self-written absolute-function:
function abs(x)
y=x
if y <0 then y=-y end
return y
end
Do you also want an integer function?
In your function you don't need to different variables.
function abs(y)
if y <0 then
return -y
end
return y
end
If you have a nice random function I would be interested.
The randomness is probably best produced at the moment by taking the last digits of the score through.
If you have a good ideas/code on doing split testing I would also be grateful. At the moment I don't have a way to test whether a change improves the recipe or doesn't.
Yes, in our (TheMarquis and me) random bond recipe, we use the sum of segment-scores as seed value, multiply it with a high value to get some "noise" and then perform a modulo operation.
And the way how you mix the segment scores together and multiply them will give some good variations:
http://fold.it/portal/recipe/2116
To check, if a recipe changed the score in a positive way, I store the sum of all segment-scores before (in this way you can also grab scores below zero) and do "save recent best".
Then I perform my desired action.
When the recipe has finished, I calculate the score-sum again,
and compare this score-sum result with the score-sum of the initial state.
If the initial state is better than the new state, I do "restore", else i keep the new puzzle result.
Also, have a look here: