Parameterize ideal function size
This commit is contained in:
@@ -5,13 +5,8 @@ import "math/rand"
|
||||
import "github.com/firestuff/subcoding/gen"
|
||||
import "github.com/firestuff/subcoding/vm"
|
||||
|
||||
const instructionsPerFunctionMean = 15
|
||||
const instrucitonsPerFunctionStdDev = 10
|
||||
|
||||
const minifyPeriodMean = 10000
|
||||
|
||||
func Mutate(_ *Definition, prog *vm.Program) {
|
||||
target := int(rand.NormFloat64()*instrucitonsPerFunctionStdDev + instructionsPerFunctionMean)
|
||||
func Mutate(def *Definition, prog *vm.Program) {
|
||||
target := int(rand.NormFloat64()*float64(def.InstructionsPerFunctionStdDev) + float64(def.InstructionsPerFunctionMean))
|
||||
|
||||
if len(prog.Functions[0].Instructions) < target {
|
||||
addInstruction(prog, prog.Functions[0])
|
||||
|
||||
Reference in New Issue
Block a user