I agree with you, when you are without any work, or spend time alone, that is when the thought of gambling will enter your mind. The more alone and free a person is, the deeper the temptation of gambling enters that person's mind, this is absolutely true.
The fact is that you need to keep yourself busy as much as possible in any way. If you have no work, read books, gain knowledge, go out, in fact, we have countless things to do, you just need to have the Desire.
Whatever a person wants from his heart, he will definitely be able to do it, no matter how difficult that work is, Desire and self-effort are the most important things. So, things have to be decided from the deep heart, Similarly, if an addicted gambler really wants to get out of the addiction of gambling, then he will definitely get rid of this addiction and can accept gambling only as entertainment.
That's the reason why it is important to have that alternative options in terms of keeping yourself busy, though it only applies with those who are not addicted yet or the level of the addiction is not that deep, they can use the option to stay away else, it will keeps on leading them to keep playing.
And for the situation where you needed to avoid getting any stress, it's a must to allocated certain budget or an amount that you are willing to let go, as if you set it up the time you reached your limit it's not hard to let go and quit away.