To paraphrase Nietszche - the only thoughts worth thinking are those had whilst walking.
So if you're stuck munching on someone else's code my advice is: go for a walk.
If you happen to have a boss and he isn't too keen on employee walks, just say something about grabbing a coffee. If he doesn't buy that then your boss sucks. Replace him.