Essentially, the simpleton is treating your previous move as either a reward or punishment.
If you cooperated, then the simpleton thinks the thing it did last time must have been good and does it again. If you cheated, the simpleton thinks the thing it did last time must have been bad and does the opposite.
It follows these rules based on its last move even if that last move was flipped from what it should have been due to the chance of mistake.