From 1aa08f927c7043a643e847c434399fc76d053df0 Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Wed, 26 Apr 2023 14:41:25 +0100 Subject: Store stred programs as a flat list of commands with no nesting, using a new jump command to simulate command blocks --- main/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'main/main.go') diff --git a/main/main.go b/main/main.go index 2067920..55ed5b5 100644 --- a/main/main.go +++ b/main/main.go @@ -13,6 +13,7 @@ type ProgramState struct { in walk.JSONIn out walk.JSONOut program []Command + pc int } func main() { @@ -55,8 +56,9 @@ func main() { } state.value = walkItem.Value state.path = walkItem.Path - for _, cmd := range state.program { - cmd.exec(&state) + state.pc = 0 + for state.pc < len(state.program) { + state.program[state.pc].exec(&state) } if !quiet { pathValues, err := walk.Compound(state.path) -- cgit v1.2.3