# data[].attributes.attachment_link.readable_text
#! /usr/bin/python3

import random

def generateNumbers(low,high,count):
    """
    Generates a tuple of random numbers in the requested range.
    Each number in the tuple is unique.
    :param low: the lowest random number
    :param high: the highest random number
    :param count: the count of random numbers to be generated
    :return: sorted tuple of integers
    :rtype: tuple
    """
    numbers = []
    while len(numbers) < count:
        z = random.randint(low,high)
        if z not in numbers:
            numbers.append(z)
    numbers.sort()
    return numbers

def countHits(numbers,guess):
    """
    Counts the number of hits for the given guess and the given numbers.
    :param numbers: the lottery numbers - a tuple of 6 integer values
    :param guess: the guess - a tuple of 6 integer values
    :return: number of hits
    :rtype: integer
    """
    hit = 0
    for a in guess:
        if a in numbers:
            hit = hit +1
    return hit

def runLottery(guess, stop, low=1, high=49, count=6):
    """
    Runs the lottery for the given guess until the number of hits equals the given stop value.
    :param guess: the guess - a tuple of 6 integer values
    :param stop: the number of hits that will terminate this function
    :param low: the lowest random number
    :param high: the highest random number
    :param count: the count of random numbers to be generated
    """
    c = 0
    while 1:
        c = c + 1
        num = generateNumbers(low,high,count)
        hits = countHits(num,guess)
        print(c,':', hits,':',num,sep='  ')
        if hits >= stop:
            return

def printLine():
    print("----------------------------------------------------------")