slot machine algorithm python