In the so-called *red and black*, a player starts with a given fortune and wants to reach a given target.
The reader may want to have a look at the exposition *[How to Gamble If You Must][1]* by Kyle Siegrist for the further reference.

For concreteness, let us call the player Milan, and
for simplicity let us say that the original fortune is $x$, $0<x<1$, and the target is $1$.
In each round, Milan bets some part of his fortune and wins with some fixed probability $p$ and looses with probability $1-p$.
In case of a win, Milan gets his bet back and additionally the same amount of money as the bet was.
In case of a loss, Milan looses the amount that he bet.
The game is over if Milan reaches the goal or if he has no money left.

One of the strategies is called *bold play*: if the fortune is less than one half, Milan bets everything.
Otherwise the bet is exactly such that in case of a win, the target is reached. Thus the probability of winning is in case of $0\leq x<\frac{1}{2}$
\begin{equation}
\varphi(x)=p\varphi(2x),
\end{equation}
and
\begin{equation}
\varphi(x)=p+(1-p)\varphi(2x-1)
\end{equation}
if $\frac{1}{2}\leq x\leq 1$ (here we also allow the cases $x=0$ and $x=1$).
Equivalently stated
\begin{align}
\varphi\left(\frac{x}{2}\right)&=p\varphi(x),\\
\varphi\left(\frac{x+1}{2}\right)&=(1-p)\varphi(x)+p
\end{align}
for all $0\leq x\leq 1$.

If the probability $p$ is not one half, then $\varphi$ is **singular**.

In our case, the success function of a strategy is the probability that Milan reaches his target starting with $x$.
A strategy $S$ is optimal if any other strategy's success function is bounded from above by $S$'s success function for every admissible bet. It turns out that if $p$ is less or equal than one half, bold play is an optimal strategy (but not the only optimal one, see the section about Unfair Trials in Siegrist's paper).

As far as I can tell, George de Rham was the first to study such kind of systems (in a different context allowing $p$ to be a complex number with absolute value less than 1) in the paper *Sur quelques courbes definies par des equations fonctionnelles* (Univ. e Politec. Torino. Rend. Sem. Mat. 16 1956/1957 101--113).
He shows that the unique bounded solution is a continuous function and the derivative, if it exists, can only be $0$.
Further, he points out that the continuous function that solves the system has been studied before.
The reader may be interested in the paper *Singular Functions with Applications
to Fractal Dimensions and Generalized
Takagi Functions* by E. de Amo, M. Díaz Carrillo, and J. Fernández-Sánchez, (Acta Appl. Math. 119 (2012), 129--148), especially Proposition 2, where the here relevant properties of $\varphi$ are listed.


  [1]: https://www.maa.org/press/periodicals/loci/how-to-gamble-if-you-must