Exemple #1
0
 def test_firstNN(self):
     self.assertEqual(libpelita.firstNN(None, False, True), False)
     self.assertEqual(libpelita.firstNN(True, False, True), True)
     self.assertEqual(libpelita.firstNN(None, None, True), True)
     self.assertEqual(libpelita.firstNN(None, 2, True), 2)
     self.assertEqual(libpelita.firstNN(None, None, None), None)
     self.assertEqual(libpelita.firstNN(), None)
Exemple #2
0
 def test_firstNN(self):
     assert libpelita.firstNN(None, False, True) == False
     assert libpelita.firstNN(True, False, True) == True
     assert libpelita.firstNN(None, None, True) == True
     assert libpelita.firstNN(None, 2, True) == 2
     assert libpelita.firstNN(None, None, None) == None
     assert libpelita.firstNN() == None
Exemple #3
0
 def test_firstNN(self):
     assert libpelita.firstNN(None, False, True) == False
     assert libpelita.firstNN(True, False, True) == True
     assert libpelita.firstNN(None, None, True) == True
     assert libpelita.firstNN(None, 2, True) == 2
     assert libpelita.firstNN(None, None, None) == None
     assert libpelita.firstNN() == None
Exemple #4
0
    if ARGS.help:
        parser.print_help()
        sys.exit(0)
    elif ARGS.setup:
        setup()
        sys.exit(0)

    # Check that pelitagame can be run
    if not os.path.isfile(ARGS.pelitagame):
        sys.stderr.write(ARGS.pelitagame + " not found!\n")
        sys.exit(2)

    with open(ARGS.config) as f:
        config_data = yaml.load(f)
        config_data["viewer"] = ARGS.viewer or config_data.get("viewer", "tk")
        config_data["interactive"] = libpelita.firstNN(ARGS.interactive, config_data.get("interactive"), True)
        config_data["statefile"] = ARGS.state
        config_data["speak"] = libpelita.firstNN(ARGS.speak, config_data.get("speak"))
        config_data["speaker"] = ARGS.speaker or config_data.get("speaker")

        config = Config(config_data)

    if not ARGS.no_log:
        # create a directory for the dumps
        def escape(s):
            return "-" + re.sub(r"[\W]", "_", str(s)) if s else ""

        storage_folder = create_directory(
            "./store{location}{year}".format(location=escape(config.location), year=escape(config.date))
        )
Exemple #5
0
        sys.exit(0)
    elif ARGS.setup:
        setup()
        sys.exit(0)


    # Check that pelitagame can be run
    if not os.path.isfile(ARGS.pelitagame):
        sys.stderr.write(ARGS.pelitagame+' not found!\n')
        sys.exit(2)


    with open(ARGS.config) as f:
        config_data = yaml.load(f)
        config_data['viewer'] = ARGS.viewer or config_data.get('viewer', 'tk')
        config_data['interactive'] = libpelita.firstNN(ARGS.interactive, config_data.get('interactive'), True)
        config_data['statefile'] = ARGS.state
        config_data['speak'] = libpelita.firstNN(ARGS.speak, config_data.get('speak'))
        config_data['speaker'] = ARGS.speaker or config_data.get('speaker')

        config = Config(config_data)

    if not ARGS.no_log:
        # create a directory for the dumps
        def escape(s):
            return "-" + re.sub(r'[\W]', '_', str(s)) if s else ""

        storage_folder = create_directory('./store{location}{year}'.format(location=escape(config.location),
                                                                      year=escape(config.date)))

        config.tournament_log_folder = storage_folder