The defining characteristic of manic-depressive illness (bipolar disorder) is alternation between mania and depression. Such alternation between extremes is also characteristic of an electronic bistable or flip-flop, the essential feature of which is positive feedback. A positive feedback loop is described which when acting with gain above a critical threshold would produce the characteristics of bipolar disorder. In this loop, perception of failure tends to increase lack of confidence, which tends to increase perception of failure, and so on; and the converse with success and confidence. It is argued that these tendencies would in moderation be favored by natural selection. For some individuals the super-critical feedback would lead to diagnosis of endogenous depression instead.