Switch to add/remove instruction mutation
This commit is contained in:
@@ -4,7 +4,6 @@ import "io"
|
||||
|
||||
import "gopkg.in/yaml.v2"
|
||||
|
||||
import "github.com/firestuff/subcoding/gen"
|
||||
import "github.com/firestuff/subcoding/vm"
|
||||
|
||||
type Definition struct {
|
||||
@@ -37,10 +36,19 @@ func (def *Definition) Grow(statusChan chan<- Status) (*vm.Program, error) {
|
||||
statusChan <- status
|
||||
}
|
||||
|
||||
prog := &vm.Program{
|
||||
GlobalMemorySize: def.GlobalMemorySize,
|
||||
FunctionMemorySize: def.FunctionMemorySize,
|
||||
InstructionLimit: def.InstructionLimit,
|
||||
Functions: []*vm.Function{
|
||||
&vm.Function{},
|
||||
},
|
||||
}
|
||||
|
||||
for {
|
||||
status.Attempts++
|
||||
|
||||
prog := gen.RandProgram(def.GlobalMemorySize, def.FunctionMemorySize, def.InstructionLimit)
|
||||
Mutate(prog)
|
||||
|
||||
score, err := def.score(prog)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user