Skip to content

Instantly share code, notes, and snippets.

@CreateRemoteThread
Created April 5, 2017 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CreateRemoteThread/b206e51703788d6c53015493e74835fb to your computer and use it in GitHub Desktop.
Save CreateRemoteThread/b206e51703788d6c53015493e74835fb to your computer and use it in GitHub Desktop.
#!/usr/bin/python2.7
import random
import config
import utils
random.seed(utils.get_pid())
ngames = 0
def generate_combination():
numbers = ""
for _ in range(10):
rand_num = random.randint(0, 99)
if rand_num < 10:
numbers += "0"
numbers += str(rand_num)
if _ != 9:
numbers += "-"
return numbers
def reset_jackpot():
random.seed(utils.get_pid())
utils.set_jackpot(0)
ngames = 0
def draw(user_guess):
ngames += 1
if ngames > config.MAX_TRIES:
reset_jackpot()
winning_combination = generate_combination()
if winning_combination == user_guess:
utils.win()
reset_jackpot()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment