示例#1
0
def main(arg):
    print ".",
    res, spy = arg
    RandomCheater.cheat_SetRate(float(res) / 10.0, float(spy) / 10.0)

    # Score of this bot is calculated relative to the scores of all these other bots.
    competitors = [ScepticBot, RandomCheater, RandomCheater, RandomCheater, RandomCheater]
    runner = CompetitionRunner(competitors, 250, quiet=True)
    runner.main()

    # TODO: Split the evaluation depending on whether the bot is Spy or Resistance.
    return (res, spy), runner.score("ScepticBot")[1] - runner.score("RandomCheater")[1]
示例#2
0
def main(arg):
    print '.',
    res, spy = arg
    RandomCheater.cheat_SetRate(float(res) / 10.0, float(spy) / 10.0)

    # Score of this bot is calculated relative to the scores of all these other bots.
    competitors = [
        ScepticBot, RandomCheater, RandomCheater, RandomCheater, RandomCheater
    ]
    runner = CompetitionRunner(competitors, 250, quiet=True)
    runner.main()

    # TODO: Split the evaluation depending on whether the bot is Spy or Resistance.
    return (
        res,
        spy), runner.score('ScepticBot')[1] - runner.score('RandomCheater')[1]
示例#3
0
 def __init__(self):
     CompetitionRunner.__init__(self, [], 0)
     self.identities = []
示例#4
0
 def __init__(self):
     CompetitionRunner.__init__(self, [], 0)
     self.identities = [] 
示例#5
0
 def __init__(self):
     CompetitionRunner.__init__(self, [], 0)
     self.games = []
     self.identities = []        
     self.expecting = None
示例#6
0
if __name__ == '__main__':
    if len(sys.argv) <= 2:
        print('USAGE: competition.py 10000 file.BotName [...]')
        sys.exit(-1)

    competitors = getCompetitors(sys.argv[2:])
    opponents = getCompetitors([# 'bots.RandomBot', 'bots.RuleFollower', 'bots.Deceiver', 'bots.Jammer', 'bots.Hippie', 'bots.Neighbor',
                                'aigd.Statistician', 'aigd.LogicalBot'])
    
    pool = competitors + opponents
    rnd = 1
    while len(pool) >= 5:
        r = int(sys.argv[1])
        if len(pool) == 5:
            runner = CompetitionRunner(pool, rounds = int(r * 2.5), quiet = False)
        else:
            runner = CompetitionRunner(pool, rounds = r, quiet = True)
        runner.main()
    
        if len(pool) == 5:
            runner.show(summary=True)
            break
        else:
            last, other = runner.last()
            print "ROUND #%i: Eliminated %s." % (rnd, last[0].__name__),
            if last[1].estimate() + last[1].error() < other[1].estimate()     \
            and other[1].estimate() + other[1].error() > last[1].estimate():
                print "(approved)"
            else:
                print "(suspect %s)" % (other[0].__name__)
示例#7
0
    if len(sys.argv) <= 2:
        print('USAGE: competition.py 10000 file.BotName [...]')
        sys.exit(-1)

    competitors = getCompetitors(sys.argv[2:])
    opponents = getCompetitors(
        [  # 'bots.RandomBot', 'bots.RuleFollower', 'bots.Deceiver', 'bots.Jammer', 'bots.Hippie', 'bots.Neighbor',
            'aigd.Statistician', 'aigd.LogicalBot'
        ])

    pool = competitors + opponents
    rnd = 1
    while len(pool) >= 5:
        r = int(sys.argv[1])
        if len(pool) == 5:
            runner = CompetitionRunner(pool, rounds=int(r * 2.5), quiet=False)
        else:
            runner = CompetitionRunner(pool, rounds=r, quiet=True)
        runner.main()

        if len(pool) == 5:
            runner.show(summary=True)
            break
        else:
            last, other = runner.last()
            print "ROUND #%i: Eliminated %s." % (rnd, last[0].__name__),
            if last[1].estimate() + last[1].error() < other[1].estimate()     \
            and other[1].estimate() + other[1].error() > last[1].estimate():
                print "(approved)"
            else:
                print "(suspect %s)" % (other[0].__name__)