예제 #1
0
파일: robot.py 프로젝트: yaniv-aknin/pybLua
 def invoke(self):
     setupLogging(self.options.log_file, self.options.log_level)
     configuration = json.load(file(self.options.configuration_file))
     with InteractionManager() as interactionManager:
         controllers = dict(
             (name, Controller(parameters["usb"], parameters["bluetooth"], interactionManager))
             for name, parameters in configuration["robots"].items()
         )
         interactionManager.takeControl(
             ConsoleManhole(self.buildInteractionNamespace(controllers, interactionManager))
         )
         for controller in controllers.values():
             controller.startService()
         reactor.run()
예제 #2
0
        game.headers["Result"] = board.result()

        moves = [move for move in board.move_stack]
        node = game.add_variation(moves.pop(0))
        n_move = 1
        for move in moves:
            node = node.add_variation(move)
            n_move += 1

        # Update this path
        path = 'C:\\Personal\\Masters Study Material\\CIS 519\\Project\\cis519chess\\games'
        if not os.path.exists(path):
            os.makedirs(path)

        with open(path + '\\self-play.pgn'.format(n_iter=n_iter), 'a') as pgn:
            pgn.write(game.accept(chess.pgn.StringExporter()))
            pgn.write('\n\n')


def main():
    play_match = SelfPlay()
    for i in range(200):
        board = play_match.mcts_one_match()
        play_match.save_pgn(board=board, n_game=i, name="MCTS", n_iter=i)


if __name__ == "__main__":
    from log import setupLogging
    setupLogging()
    main()