Gambling is a hobby, it is something to pass the time, so if you have something to do you will not gamble.
This is what most of people addicted with a bad habit do.
They make them selves busy in order to not practice their addiction and I think that it is really an efficient way.