env = newCleanEnv()
gui = loadSnippet(input or "#224", env)

function step()
  local a = env.animateAgainIn
  env.pixels = nil -- so we can safely keep older pixel arrays
  if a == nil then error "Animation ended" end
  if type(a) == 'table' then
    a[2]()
  else
    gui()
  end
end

function pixelsAreEqual(a, b)
  return a == b -- We COULD account for the different pixel formats, but that case is SO unlikely to be relevant...
end

function hasMovement(old, new)
  if new == nil then return false end
  if old == nil then error "Can't evaluate" end
  local n = #old
  for i=1, n do
    if not pixelsAreEqual(old[i], new[i]) then
      return true
    end
  end
  return false
end

gui()
old = env.pixels
step()
new = env.pixels
movement = hasMovement(old, new)
print("has movement: "..tostring(movement))