Implementation of the Mastermind algorithm with constant memory