Esempio n. 1
0
def client_run(options, admin_key):
    start_logging('admin')
    factory = ComClientFactory()
    factory.options = options
    factory.dispatcher = Dispatch('administration', admin_key)
    if hasattr(options, 'command_file'):
        factory.command_file = open(options.command_file, 'r')
    reactor.connectTCP(options.host, int(options.port), factory)
    reactor.run()
Esempio n. 2
0
def client_run(options, admin_key):
    start_logging('admin')
    factory = ComClientFactory()
    factory.options = options
    factory.dispatcher = Dispatch('administration', admin_key)
    if hasattr(options, 'command_file'):
        factory.command_file = open(options.command_file, 'r')
    reactor.connectTCP(options.host, int(options.port), factory)
    reactor.run()
Esempio n. 3
0
def set_options(o):
    o.evaluate_mwc = False

def usage(progname):
    usg = """usage: %prog [<gid>] <test_game_data> <dice> <invitations>
  %prog """ + __doc__
    parser = get_parser(usg)
    return parser, usg

if __name__ == "__main__":
    parser,usg = usage(sys.argv[0])
    (options, args) = parser.parse_args()
    set_options(options)

    start_logging(options.user)
    factory = ComClientFactory()
    factory.options = options
    server_port = int(options.port)
    factory.dispatcher = DispatchTest(options.user, options.password,
                                      ka_lap=options.keep_alive,
                                      ignore_resume=options.ignore_resume,
                                      fixed_opponent=options.fixed_opponent)
    options.number_of_games = -1
    options.testgame = args[0]
    bridge = set_up_testgame(options.testgame)
    if not bridge is None:
        factory.gnubg = bridge
        bridge.set_bot(factory.dispatcher)
        standard_running = True
    else:
        print "Can't find %s." % options.testgame
Esempio n. 4
0
  %prog """ + __doc__
    parser = get_parser(usg)
    parser.add_option("-s", "--strength", default='supremo',
                  action="store", dest="strength",
                  help="bots strength. (supremo)")
    parser.add_option("-E", "--evaluate", default=False,
                  action="store_true", dest="evaluate_mwc",
                  help="accept evaluation requests, only. (False)")
    return parser,usg

if __name__ == "__main__":
    parser,usg = usage(sys.argv[0])
    (options, args) = parser.parse_args()

    start_logging(options.user)
    factory = ComClientFactory()
    factory.options = options
    server_port = int(options.port)
    factory.dispatcher = Dispatch(options.user, options.password,
                                  options.strength, options.keep_alive,
                                  options.ignore_resume, options.fixed_opponent)
    # connect to a running gnubg instance
    standard_running = False
    for g, h, p in (('gnubg', 'localhost', GNUBG),
                 ('hyperbg', 'localhost', HYPERBG)):
        gnubg = set_up_gnubg(g, h, port=p)
        if gnubg is not None:    # TODO: react to missing gnubg (now start one)
            factory.gnubg = gnubg
            gnubg.set_bot(factory.dispatcher)
            if g == 'gnubg':
                standard_running = True
Esempio n. 5
0
        "-E",
        "--evaluate",
        default=False,
        action="store_true",
        dest="evaluate_mwc",
        help="accept evaluation requests, only. (False)",
    )
    return parser, usg


if __name__ == "__main__":
    parser, usg = usage(sys.argv[0])
    (options, args) = parser.parse_args()

    start_logging(options.user)
    factory = ComClientFactory()
    factory.options = options
    server_port = int(options.port)
    factory.dispatcher = Dispatch(
        options.user,
        options.password,
        options.strength,
        options.keep_alive,
        options.ignore_resume,
        options.fixed_opponent,
    )
    # connect to a running gnubg instance
    standard_running = False
    for g, h, p in (("gnubg", "localhost", GNUBG), ("hyperbg", "localhost", HYPERBG)):
        gnubg = set_up_gnubg(g, h, port=p)
        if gnubg is not None:  # TODO: react to missing gnubg (now start one)