25 lines
463 B
Go
25 lines
463 B
Go
package grow
|
|
|
|
import "github.com/firestuff/subcoding/vm"
|
|
|
|
type Sample struct {
|
|
In []uint64 `yaml:"in,flow"`
|
|
Out []uint64 `yaml:"out,flow"`
|
|
}
|
|
|
|
func (s *Sample) SetInputs(state *vm.State) {
|
|
for i, val := range s.In {
|
|
state.GlobalMemory().WriteUnsigned(uint64(i), val)
|
|
}
|
|
}
|
|
|
|
func (s *Sample) OutputsMatch(state *vm.State) bool {
|
|
for i, val := range s.Out {
|
|
if state.GlobalMemory().MustReadUnsigned(uint64(i)) != val {
|
|
return false
|
|
}
|
|
}
|
|
|
|
return true
|
|
}
|