A favorable game is one in which, loosely speaking, there are opportunities for favorable bets. We consider only games where there is a "double or nothing" return of the stake, the win probability $p$ being drawn independently each day from a distribution $F(p)$, and told to the player before he makes his bet. We are interested, not in maximizing the expected fortune over a number of plays, but in minimizing the probability of eventual ruin. In order that the gambler cannot stand pat, we use two devices. In Model I, he must pay a fee of $1 after each play. In Model II, he must bet a minimum of $1. His bet may never exceed his current fortune, $x$. Let $b$ denote an allowable betting strategy. We define the ruin function by $q(x) = \inf_bP$ (ruin $\mid b$, starting fortune $x$). In both models, if ever $x < 1$, ruin is inevitable. In Section 3, we introduce (following Ferguson, [3]) the idea of a loss function, $q_o(x)$, satisfying certain conditions. A "natural" choice for loss function is $q_0^\ast(x) = 1$ for $x < 1, = 0$ otherwise. We define the minimal expected loss after $n$ games by $q_n(x) = \inf_bEq_0(X_n)$ where $X_n$ is the fortune after the $n$th game. In Lemmas 3.1-3.5, we construct a suitable Borel-measurable betting function to show that $q_n(x)$ satisfies the dynamic programming relationship; if $x \rightarrow X_1(b_1)$ after bet $b_1$, then $q_n(x) = \inf_{b_1} Eq_{n-1} (X_1(b_1))$. The results of Section 3 do not depend on the assumption that the game is favorable, but from now on this assumption is required. Using the natural loss function $q_0^\ast(x)$, we show in Lemma 4.1 that $q_n^\ast(x) \rightarrow q(x)$ as $n \rightarrow \infty$, uniformly in $x$ (in passing, Theorem 5.1 shows that for any loss function, $q_n(x) \rightarrow q(x)$ without uniformity) and we employ this result in Section 6 to show that $q(x)$ is continuous, for Model I only. For both models, $q(x)$ is already known [1] to be lower semi-continuous. These results are sufficient to establish [3] that a particular stationary Markov betting function, $b^\ast(x, p)$, is optimal (although not necessarily unique). For large fortunes $x$, asymptotic forms for the ruin function $q(x)$, and as a consequence for $b^\ast(x, p)$, are already known [1], [3] under a slight restriction on $F(p)$, namely that it have no mass in a neighborhood of 1. On removing the restriction, some weaker results are obtained, and summarized in Section 8.