#NEWLINE# def main( ) : #NEWLINE# #INDENT# with Input ( ) as input : #NEWLINE# #INDENT# with FullscreenWindow ( ) as window : #NEWLINE# #INDENT# b = Board ( ) #NEWLINE# while True : #NEWLINE# #INDENT# window . render_to_terminal ( b . display ( ) ) #NEWLINE# if ( ( b . turn == 9 ) or b . winner ( ) ) : #NEWLINE# #INDENT# c = input . next ( ) #NEWLINE# sys . exit ( ) #NEWLINE# #UNINDENT# while True : #NEWLINE# #INDENT# c = input . next ( ) #NEWLINE# if ( c == '\x04' ) : #NEWLINE# #INDENT# sys . exit ( ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# if ( int ( c ) in range ( 9 ) ) : #NEWLINE# #INDENT# b = b . move ( int ( c ) ) #NEWLINE# #UNINDENT# #UNINDENT# except ValueError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# window . render_to_terminal ( b . display ( ) ) #NEWLINE# break #NEWLINE# #UNINDENT# if ( ( b . turn == 9 ) or b . winner ( ) ) : #NEWLINE# #INDENT# c = input . next ( ) #NEWLINE# sys . exit ( ) #NEWLINE# #UNINDENT# b = ai ( b , 'o' )