code of single simulator