Minify program after hitting score
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package grow
|
||||
|
||||
import "math"
|
||||
import "math/rand"
|
||||
|
||||
import "github.com/firestuff/subcoding/gen"
|
||||
@@ -10,7 +9,7 @@ const instructionsPerFunctionMean = 15
|
||||
const instrucitonsPerFunctionStdDev = 10
|
||||
|
||||
func Mutate(prog *vm.Program) {
|
||||
target := int(math.Max(2, rand.NormFloat64()*instrucitonsPerFunctionStdDev+instructionsPerFunctionMean))
|
||||
target := int(rand.NormFloat64()*instrucitonsPerFunctionStdDev+instructionsPerFunctionMean)
|
||||
|
||||
if len(prog.Functions[0].Instructions) < target {
|
||||
addInstruction(prog, prog.Functions[0])
|
||||
|
||||
Reference in New Issue
Block a user