I vape. I find that vaping requires a more regular "hit" than actual cigarettes, so roughly every hour as opposed to every 1.,5-2 hours or so. I find that the act of walking down and back up the stairs, and getting some "fresh" air, not only helps my productivity through brain rest, but also because somehow, complex coding problems sometimes "come together" better when I'm not in front of the code.
Not suggesting anyone addict themselves to nicotine, because you could achieve this without smoking/vaping, but the act of doing something completely different does seem to allow my brain to subconsciously put stuff together somehow.