Skip to main content
Commonmark migration
Source Link

#Eidetic, Python 2

Eidetic, Python 2

#Eidetic, Python 2

Eidetic, Python 2

update training data
Source Link
Blue
  • 28.6k
  • 8
  • 52
  • 100
import random, math, sys, json

total_degrees, degrees_left, total_people, people_left = map(int, sys.argv[1:])
try#try:
#    inp_f = open("./data/Eidetic.json", "r")
#    out = json.load(inp_f)
except#except (IOError, ValueError):
    out = {"last_cake": 0,
           "runs": 0,
           "total_runs": 0,
           "total_rounds": 0,
           "training":  [[0.0], [0.0], [0.0]12903225806451613], [4[16.0]774193548387096], [400.0], [426.0]83870967741933], [720.0], [1042[995.0]8709677419355], [1042[996.3129032258064]9437634408603], [1044[997.0]6], [1044[997.0]6], [1044[997.0]6], [1044[998.9741935483871]5991397849463], [1045[996.3129032258064]6770967741936], [1051[998.3677419354838]8122580645161], [1056[1011.4022617124394]5467420570814], [1264[1017.1534733441033]7717824448034], [1378[1227.663974151858]155465805062], [1451[1280.5218093699516]7840603123318], [1473[1435.0856219709208]8028540656974], [1662[1553.069466882068]3689822294023], [1828[1793.9919224555736]5330640818527], [2671[2299.3430420711975]178101402373], [4423[3183.720064724919]924709689701], [3625[2231.3333333333335]666666666667], [2619.4789644012944], [1270.9288025889969], [741.2718446601941], [480.4757281553398], [122.66990291262135], [27.54736842105263]]}

else#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
    #syssys.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()
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()
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.12903225806451613], [16.774193548387096], [400.83870967741933], [720.0], [995.8709677419355], [996.9437634408603], [997.6], [997.6], [997.6], [998.5991397849463], [996.6770967741936], [998.8122580645161], [1011.5467420570814], [1017.7717824448034], [1227.155465805062], [1280.7840603123318], [1435.8028540656974], [1553.3689822294023], [1793.5330640818527], [2299.178101402373], [3183.924709689701], [2231.666666666667], [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()
added 62 characters in body
Source Link
Blue
  • 28.6k
  • 8
  • 52
  • 100
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.00], 0[0.00], 0[0.00], 4[4.00], 400[400.00], 426[426.00], 720[720.00], 1042[1042.00], 1042[1042.31290322580643129032258064], 1044[1044.00], 1044[1044.00], 1044[1044.00], 1044[1044.97419354838719741935483871], 1045[1045.31290322580643129032258064], 1051[1051.36774193548383677419354838], 1056[1056.40226171243944022617124394], 1264[1264.15347334410331534733441033], 1378[1378.663974151858663974151858], 1451[1451.52180936995165218093699516], 1473[1473.08562197092080856219709208], 1662[1662.069466882068069466882068], 1828[1828.99192245557369919224555736], 2671[2671.34304207119753430420711975], 4423[4423.720064724919720064724919], 3625[3625.33333333333353333333333335], 2619[2619.47896440129444789644012944], 1270[1270.92880258899699288025889969], 741[741.27184466019412718446601941], 480[480.47572815533984757281553398], 122[122.6699029126213566990291262135], 27[27.54736842105263]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()
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()
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()
update default values
Source Link
Blue
  • 28.6k
  • 8
  • 52
  • 100
Loading
Source Link
Blue
  • 28.6k
  • 8
  • 52
  • 100
Loading