rewrote the dogPlay function to do a small calculation while allowing
there to be a nested while loop,