This reward-based learning process is called positive and negative reinforcement, and basically goes like this.
Este processo à base de recompensa chama-se reforço positivo e negativo, e funciona basicamente assim: