Sample simulation code written in scala