Dynamic programming (DP) is a general algorithmic approach used in optimal control and Markov decision processes that balances desire for low present costs with undesirability of high future costs when choosing a sequence of controls to apply over time. Recent interest in this field has grown since Google Deepmind’s algorithms have beaten humans and world-champion programs in Atari games, and games such as chess, shogi, and go. But why do these algorithms work as well as they do? In many image-based tasks, early-layer weights of trained deep neural networks often resemble neural receptive field profiles found in the mammalian visual system. From modelling efforts in the neuroscience and signal processing communities we know this architecture generates efficient (low bit-rate) representations of natural images called sparse codes. In this work, I investigate the computational role of sparse codes by applying DP to solve the optimal control problem of tracking an object (dragonfly) over a sequence of natural images. By comparing speed of learning, memory capacity, interference, generalization, and fault tolerance for different codes, I will show some distinct computational advantages of sparse codes.