diff --git a/src/cse-machine/interpreter.ts b/src/cse-machine/interpreter.ts index df91d53ae..426e12605 100644 --- a/src/cse-machine/interpreter.ts +++ b/src/cse-machine/interpreter.ts @@ -305,7 +305,9 @@ export function* generateCSEMachineStateStream( ) { context.runtime.break = false context.runtime.nodes = [] - let steps = 1 + + // steps: number of steps completed + let steps = 0 let command = control.peek() @@ -357,11 +359,11 @@ export function* generateCSEMachineStateStream( command = control.peek() steps += 1 - yield { stash, control, steps } - } + if (!isPrelude) { + context.runtime.envStepsTotal = steps + } - if (!isPrelude) { - context.runtime.envStepsTotal = steps + yield { stash, control, steps } } }