Reinforcement Learning has a reward and/or cost function. Example of a reward function is go out of a maze in x number of minutes. Further training reduces this time. A cost function is like if hit that, -y points. Further trainings will enable it to avoid those actions.

Programmable AI to beat games make use of this method