simulator code