On a memory game and preferential attachment graphs