require "big" struct AmongUs::Program < Flint::Program def interpret : Nil code = Parser.new(@source_io).parse jumps = find_jumps(code) stack = [] of BigInt acc1 = BigInt.new acc2 = BigInt.new color = code.find &.is_a?(Color) puts code puts jumps end private def find_jumps(code : Array(Instruction)) : Hash(Int32, Int32) jumps = {} of Int32 => Int32 stack = [] of Int32 code.each_index do |i| case code[i] when Command::WHO stack << i when Command::WHERE jumps[i] = stack.pop jumps[jumps[i]] = i end end return jumps end end