An Adaptive Memory-Based Reinforcement Learning Controller