Added loop counter to while loop to stop after 3 attempts to move pig.