The recursion of the algorithm terminates when the sequence is empty .
When the player possesses insufficient funds to continue betting .
The recursion of the algorithm terminates when the sequence is empty or when the player possesses insufficient funds to continue betting .