import random

sequence = []

def add_to_sequence():
    sequence.append(random.randint(1, 4))

add_to_sequence()

current = 0

def on_key_down(key):
    global current

    if key in (keys.K_1, keys.K_2, keys.K_3, keys.K_4):
        if key == keys.K_1:
            number = 1
        elif key == keys.K_2:
            number = 2
        elif key == keys.K_3:
            number = 3
        elif key == keys.K_4:
            number = 4

        if number == sequence[current]:
            current += 1
            if current == len(sequence):
                current = 0
                add_to_sequence()

def draw():
    screen.fill((0, 0, 0))

    screen.draw.text(', '.join(map(str, sequence)), (0, 0))
    screen.draw.text(str(current + 1) + '/' + str(len(sequence)), (0, 20))
    screen.draw.text('sequence[current]: ' + str(sequence[current]), (0, 40))