def main():
    with Input() as input:
        with FullscreenWindow() as window:
            b = Board()
            while True:
                window.render_to_terminal(b.display())
                if b.turn == 9 or b.winner():
                    c = input.next() # hit any key
                    sys.exit()
                while True:
                    c = input.next()
                    if c == '':
                        sys.exit()
                    try:
                        if int(c) in range(9):
                            b = b.move(int(c))
                    except __HOLE__:
                        continue
                    window.render_to_terminal(b.display())
                    break
                if b.turn == 9 or b.winner():
                    c = input.next() # hit any key
                    sys.exit()
                b = ai(b, 'o')
dataset/ETHPy150Open thomasballinger/curtsies/examples/tictactoeexample.py/main