Files
subcoding/grow/sample.go

25 lines
463 B
Go
Raw Normal View History

2021-11-20 19:38:31 -10:00
package grow
import "github.com/firestuff/subcoding/vm"
type Sample struct {
2021-11-20 20:14:35 -10:00
In []uint64 `yaml:"in,flow"`
Out []uint64 `yaml:"out,flow"`
}
func (s *Sample) SetInputs(state *vm.State) {
2021-11-20 20:14:35 -10:00
for i, val := range s.In {
state.GlobalMemory().WriteUnsigned(uint64(i), val)
}
}
func (s *Sample) OutputsMatch(state *vm.State) bool {
2021-11-20 20:14:35 -10:00
for i, val := range s.Out {
if state.GlobalMemory().MustReadUnsigned(uint64(i)) != val {
return false
}
}
return true
}