Example #1
0
def command_line_parser():
    """Entry function"""
    print(__doc__)
    args = docopt(__doc__)
    if args['--log']:
        logfile = args['--log']
    else:
        print("Using default log file")
        logfile = 'default'
    model_name = args['--name'] if args['--name'] else 'dqn1'
    screenloglevel = logging.INFO if not args['--screenloglevel'] else \
        getattr(logging, args['--screenloglevel'].upper())
    _ = get_config()
    init_logger(screenlevel=screenloglevel, filename=logfile)
    print(f"Screenloglevel: {screenloglevel}")
    log = logging.getLogger("")
    log.info("Initializing program")

    if args['selfplay']:
        num_episodes = 1 if not args['--episodes'] else int(args['--episodes'])
        runner = SelfPlay(render=args['--render'], num_episodes=num_episodes, use_nn_equity=args['--use_nn_equity'],
                          use_cpp_montecarlo=args['--use_cpp_montecarlo'],
                          funds_plot=args['--funds_plot'],
                          stack=int(args['--stack']))

        if args['random']:
            runner.random_agents()

        elif args['keypress']:
            runner.key_press_agents()

        elif args['consider_equity']:
            runner.equity_vs_random()

        elif args['equity_improvement']:
            improvement_rounds = int(args['--improvement_rounds'])
            runner.equity_self_improvement(improvement_rounds)

        elif args['dqn_train']:
            runner.dqn_train_keras_rl(model_name)

        elif args['dqn_train_heads_up']:
            runner.dqn_train_heads_up_keras_rl(model_name)

        elif args['dqn_play']:
            runner.dqn_play_keras_rl(model_name)


    else:
        raise RuntimeError("Argument not yet implemented")
Example #2
0
def run_poker():
    init_logger(screenlevel=logging.INFO,
                filename='deepmind_pokerbot',
                logdir='log')
    # print(f"Screenloglevel: {screenloglevel}")
    log = logging.getLogger("")
    log.info("Initializing program")

    # Back up the reference to the exceptionhook
    sys._excepthook = sys.excepthook
    log.info("Check for auto-update")
    updater = UpdateChecker()
    updater.check_update(version)
    log.info(f"Lastest version already installed: {version}")

    t1 = ThreadManager(1, "Thread-1", 1, updater)
    t1.start()
Example #3
0
def command_line_parser():
    """Entry function"""
    args = docopt(__doc__)
    if args['--log']:
        logfile = args['--log']
    else:
        print("Using default log file")
        logfile = 'default'
    screenloglevel = logging.INFO if not args['--screenloglevel'] else \
        getattr(logging, args['--screenloglevel'].upper())
    _ = get_config()
    init_logger(screenlevel=screenloglevel, filename=logfile)
    print(f"Screenloglevel: {screenloglevel}")
    log = logging.getLogger("")
    log.info("Initializing program")

    num_episodes = 1 if not args['--episodes'] else int(args['--episodes'])
    runner = Runner(render=args['--render'], num_episodes=num_episodes)

    if args['random']:
        runner.random_agents()

    elif args['uto']:
        runner.uto_plays()

    elif args['keypress']:
        runner.key_press_agents()

    elif args['consider_equity']:
        runner.equity_vs_random()

    elif args['equity_improvement']:
        improvement_rounds = int(args['--improvement_rounds'])
        runner.equity_self_improvement(improvement_rounds)

    elif args['dqn_train']:
        runner.dqn_train()

    elif args['dqn_play']:
        runner.dqn_play()

    else:
        raise RuntimeError("Argument not yet implemented")