Natural organisms have transitioned from one niche to another over the course of evolution and have adapted accordingly. In particular, if these transition go back and forth between two niches repeatedly, such as transitioning between diurnal and nocturnal lifestyles, this should over time result in adaptations that are beneficial to both environments. Furthermore, they should also adapt to the transitions themselves. Here we answer how Markov Brains, which are an analogue to natural brains, change structurally and functionally when experiencing periodic changes. We show that if environments change sufficiently fast, the structural components that form the brains become useful in both environments. However, brains evolve to perform different computations while using the same components, and thus have computational structures that are multifunctional.