Many agent problems in a grid world have a restricted sensory information and motor actions. The environmental conditions need dynamic processing of internal memory. In this paper, we handle the artificial ant problem, an agent task to model ant trail following in a grid world, which is one of the difficult problems that purely reactive systems cannot solve. We provide an evolutionary approach to quantify the amount of memory needed for the agent problem and explore a systematic analysis over the memory usage. We apply two types of memory-based control structures, Koza's genetic programming and finite state machines, to recognize the relevance of internal memory. Statistical significance test based on beta distribution differentiates the characteristics and performances of the two control structures.