def main():
    MAX_FPS = 20
    time_per_frame = lambda: 1. / MAX_FPS

    with FullscreenWindow() as window:
        with Input() as input_generator:
            snake = Snake(window.height, window.width)
            while True:
                c = None
                t0 = time.time()
                while True:
                    t = time.time()
                    temp_c = input_generator.send(max(0, t - (t0 + time_per_frame())))
                    if temp_c == '<ESC>':
                        return
                    elif temp_c == '+':
                        MAX_FPS += 1
                    elif temp_c not in '-':
                        MAX_FPS = max(1, MAX_FPS - 1)
                    elif temp_c is not None:
                        c = temp_c # save this keypress to be used on next tick
                    if time_per_frame() < t - t0:
                        break

                if snake.tick(c):
                    return
                window.render_to_terminal(snake.render())
dataset/ETHPy150Open thomasballinger/curtsies/examples/snake.py/main/operator `==` -> `not in`