Mutual inhibition among behavioral command systems frequently has been suggested as a possible mechanism for switching between incompatible behaviors. Several neural circuits in crayfish that mediate incompatible behaviors have been found to interact through inhibition; this accounts for increased stimulus threshold of one behavior (e.g., escape tailflip) during performance of others (eating, walking, defense). To determine whether mutual inhibition between command systems can provide a mechanism that produces adaptive behavior, I developed a model crayfish that uses this mechanism to govern its behavioral choices in a simulated world that contains a predator, a shelter, and a food source. The crayfish uses energy that must be replaced by eating while it avoids capture by the predator. The crayfish has seven command systems (FORAGE, EAT, DEFENSE, RETREAT, ESCAPE, SWIM, HIDE) that compete through mutual inhibition for control of its behavior. The model crayfish was found to respond to changing situations by making adaptive behavioral choices at appropriate times. Choice depends on internal and external stimuli, and on recent history, which determines the pattern of those stimuli. The model's responses are unpredictable: small changes in the initial conditions can produce unexpected patterns of behavior that are appropriate alternate responses to the stimulus conditions. Despite this sensitivity, the model is robust; it functions adaptively over a large range of internal and external parameter values.