If addictions and problematic behaviors arise from interactions between drugs, reward sequences, and natural learning sytems, then an explanation of clinically problematic conditions (such as the self-administration of drugs or problem gambling) requires an understanding of the neural systems that have evolved to allow an agent to make decisions. We hypothesize a unified decision-making system consisting of three components - a situation recognition system, a flexible, planning-capable system, and an inflexible, habit-like system. In this article, we present a model of the planning-capable system based on a planning process arising from experimentally observed look-ahead dynamics in the hippocampus enabling a forward search of possibilities and an evaluation process in the nucleus accumbens. Based on evidence that opioid signaling can provide hedonic evalutation of an achieved outcome, we hypothesize that similar opioid-signaling processes evaluate the value of expected outcomes. This leads to a model of craving, based on the recognition of a path to a high-value outcome, and obsession, based on a value-induced limitation of the search process. This theory can explain why opioid antagonists reduce both hedonic responses and craving.