#Eidetic, Python 2 import random, math, sys, json total_degrees, degrees_left, total_people, people_left = map(int, sys.argv[1:]) try: inp_f = open("./data/Eidetic.json", "r") out = json.load(inp_f) except (IOError, ValueError): out = {"last_cake": 0, "runs": 0, "total_runs": 0, "total_rounds": 0, "training": [[0.0], [0.0], [0.0], [4.0], [400.0], [426.0], [720.0], [1042.0], [1042.3129032258064], [1044.0], [1044.0], [1044.0], [1044.9741935483871], [1045.3129032258064], [1051.3677419354838], [1056.4022617124394], [1264.1534733441033], [1378.663974151858], [1451.5218093699516], [1473.0856219709208], [1662.069466882068], [1828.9919224555736], [2671.3430420711975], [4423.720064724919], [3625.3333333333335], [2619.4789644012944], [1270.9288025889969], [741.2718446601941], [480.4757281553398], [122.66990291262135], [27.54736842105263]]} else: inp_f.close() def write_out(): out_f = open("./data/Eidetic.json", "w") out_f.write(json.dumps(out)) out_f.close() def get_last_winner(): # Find the bid of the last winner bid = out["last_cake"] return max(bid, degrees_left) - degrees_left def train(): # print degrees_left # If you get that much, your probably safe. # sys.stderr.write("\nEidetic - Training len %s, no runs: %s, no_rounds: %s, last winner: %s\n"%(len(out["training"]), out["runs"], out["total_rounds"], get_last_winner())) if len(out["training"]) <= out["runs"]: out["training"].append([]) out["training"][out["runs"]].append(get_last_winner()) def get_best_round(): data = out["training"][out["runs"]+1:] mean = [sum(i)/(float(len(i)) or 1) for i in data] bid = max(mean+[0]) - 0.5 #sys.stderr.write("\nEidetic - mean %s\n"%mean) return bid def main(): reset = total_people == people_left if reset: out["total_rounds"] += 1 out["runs"] = 0 train() bid = get_best_round() print bid # sys.stderr.write('\nEidetic Bid: '+str(bid)+'\n') out["total_runs"] += 1 out["runs"] += 1 out["last_cake"] = degrees_left write_out() main() I ran this bot in the controller a couple of times to train it up a bit, it remembers the bids required to win each round and then once trained, it goes out into the real world and votes with the rest of them.