This reminds me of an experiment in grad school on spatial memory in rats. We noticed that during sleep their hippocampal place cells would fire in a way similar to those seen during maze navigation. I personally experience this all the time, if I've been programming all day, I will be in a 'dream-like' state within the program