Epigenetic switching outcompetes genetic mutations during adaptation to fluctuating environments