Update simulator.java

Fixed out of bounds exceptions