working sweep_sheep and move_dog_to_the_other_side function