We present an approach to learning cooperative behavior of agents. Our approach is based on classifying situations with the help of the nearest-neighbor rule. In this context, learning amounts to evolving a set of good prototypical situations. With each prototypical situation an action is associated that should be executed in that situation. A set of prototypical situation/action pairs together with the nearest-neighbor rule represent the behavior of an agent. We demonstrate the utility of our approach in the light of variants of the well-known pursuit game. To this end, we present a classification of variants of the pursuit game, and we report on the results of our approach obtained for variants regarding several aspects of the classification. A first implementation of our approach that utilizes a genetic algorithm to conduct the search for a set of suitable prototypical situation/action pairs was able to handle many different variants.