Exemplo n.º 1
0
def main():
    yield from flash(30, 30, 30)

    combination = []
    while True:
        combination.append(t3.randrange(0, 4))

        # Play combination
        yield 0.5
        for c in combination:
            display_piece(c)
            yield 0.4
            fill(0, 0, 0)
            t3.tone(0)
            yield 0.2

        # Expect combination
        for c in combination:
            fill(0, 0, 0)
            while get_input() != -1:
                yield 0.05
            while True:
                display_prompt()
                inp = get_input()
                if inp == -1:
                    yield 0.05
                    continue
                display_piece(inp)
                if inp != c:
                    while get_input() != -1:
                        yield 0.05
                    t3.tone(0)
                    fill(0, 0, 0)
                    yield 0.1
                    yield from flash(100, 0, 0)
                    fill(0, 0, 0)
                    combination = []
                    break
                else:
                    while get_input() != -1:
                        yield 0.05
                    t3.tone(0)
                    break
            if not combination:
                break
        else:
            fill(0, 0, 0)
            yield 0.5
            hue = t3.random_uniform(0.23, 0.37)
            yield from flash(0, 70, 0)
Exemplo n.º 2
0
def reddish():
    hue = t3.random_uniform(-0.07, 0.07)
    sat = 0.26
    lightness = 0.4
    return t3.hls_to_rgb(hue, sat, lightness)
Exemplo n.º 3
0
def bluish():
    hue = t3.random_uniform(0.43, 0.67)
    sat = 0.26
    lightness = 0.4
    return t3.hls_to_rgb(hue, sat, lightness)