random exploration of maze with memory