py/arena.py
def post_state(self):
        '''Writes a json file with the current state to poll'''

        # Write the position state
        self.state['fen'] = self.board.fen()

        fullmove_number = self.board.fullmove_number

        # Write desc 
        if not self.board.is_game_over():
            #Turn and player if the game is ongoing
            self.state['desc'] = 'Turn %i, %s to move' % (fullmove_number, 'WHITE' if self.board.turn else 'BLACK')
        
        elif self.board.is_checkmate():
            # Winner of the game if checkmate
            self.state['desc'] = 'Turn %i, Game over! %s wins!' % (fullmove_number, 'WHITE' if not self.board.turn else 'BLACK')
            self.state['winner'] = (not self.board.turn)

        else:
            # Draw if draw, no reason given
            self.state['desc'] = 'Turn %i, Draw!' % fullmove_number
            self.state['winner'] = None

        with open('../html/state', 'w') as f:
            f.write(json.dumps(self.state, indent=4))

        # Note the time
        self.state_post_time = time.time()
Writes a json file with the current state to poll
Writes a json file with the current state to poll
Writes a json file with the current state to poll
def post_state(self):
        self.state['fen'] = self.board.fen()
        fullmove_number = self.board.fullmove_number
        if not self.board.is_game_over():
            self.state['desc'] = 'Turn %i, %s to move' % (fullmove_number, 'WHITE' if self.board.turn else 'BLACK')
        elif self.board.is_checkmate():
            self.state['desc'] = 'Turn %i, Game over! %s wins!' % (fullmove_number, 'WHITE' if not self.board.turn else 'BLACK')
            self.state['winner'] = (not self.board.turn)
        else:
            self.state['desc'] = 'Turn %i, Draw!' % fullmove_number
            self.state['winner'] = None
        with open('../html/state', 'w') as f:
            f.write(json.dumps(self.state, indent=4))
        self.state_post_time = time.time()
def post_state ( self ) : self . state [ 'fen' ] = self . board . fen ( ) fullmove_number = self . board . fullmove_number if not self . board . is_game_over ( ) : self . state [ 'desc' ] = 'Turn %i, %s to move' % ( fullmove_number , 'WHITE' if self . board . turn else 'BLACK' ) elif self . board . is_checkmate ( ) : self . state [ 'desc' ] = 'Turn %i, Game over! %s wins!' % ( fullmove_number , 'WHITE' if not self . board . turn else 'BLACK' ) self . state [ 'winner' ] = ( not self . board . turn ) else : self . state [ 'desc' ] = 'Turn %i, Draw!' % fullmove_number self . state [ 'winner' ] = None with open ( '../html/state' , 'w' ) as f : f . write ( json . dumps ( self . state , indent = 4 ) ) self . state_post_time = time . time ( )
Writes a json file with the current state to poll
Writes a json file with the current state to poll
'''Writes a json file with the current state to poll''' # Write the position state # Write desc  #Turn and player if the game is ongoing # Winner of the game if checkmate # Draw if draw, no reason given # Note the time
self