implemented a simple simulation code