def main(argv):
    print "# agents, agents/goals, delta t"
    nTrials, size = 500, 15
    agentsGoals = [(2, 12), (3, 11), (4, 10), (5, 9), (6, 8), (7, 7), (8, 6), (9, 5), (10, 4), (11, 3), (12, 2)]

    for nAgents, nGoals in agentsGoals:
        deltaT = []
        for trial in range(nTrials):
            world, agents = initWorld(nAgents, nGoals, size)
            t_noncollab = timeToGoal(world)
            world, agents = initWorld(nAgents, nGoals, size)
            connectFully(agents)
            t_collab = timeToGoal(world)
            deltaT.append(t_noncollab - t_collab)
        print "%s %s %s" % (nAgents, nAgents / float(nGoals), mean(deltaT))
def main(argv):
    size = 15
    trials = 2
    nAgents = int(sys.argv[1])
    nGoals = int(sys.argv[2])

    print "#agents, goals, rate of collaboration, point for collab,"
    print "#points noncollaborators, weird payoff thing "
    print "#mean time"
    for rate in map(lambda x: 0.1 * x, range(11)):
        meanPayoff, payoffPerTime, meanTime, nonCollab = 0.0, 0.0, 0.0, 0.0
        for trial in range(trials):
            world, agents = initWorld(nAgents, nGoals, size)
            t, collab, non = payoffForCollaboration(rate, agents, world)
            payoffPerTime = collab / t
            meanPayoff += collab
            nonCollab += non
            meanTime += t
        meanPayoff /= float(trials)
        meanTime /= float(trials)
        payoffPerTime /= float(trials)
        nonCollab /= float(trials)

        print "%s %s %s %s %s %s %s" % (nAgents, nGoals, rate, meanPayoff, nonCollab, payoffPerTime, meanTime)
        sys.stdout.flush()