here is the final arrangement. i had to remove 16 of darvince's needles because they were going over the cost limit
i also couldn't code everyone's strategy, but i did the best i could. remember, as per op, strategy only knows the damage done and the damage taken, nothing else. if you follow that, you're good. also, random is allowed.
def makestrat(mindo = 0, maxtake = float('inf')):
def strat(send, recv):
if recv > maxtake:
return 2
elif mindo > send:
return 1
else:
return 0
return strat
def lincom(objdict):
results = []
for o, n in objdict.items():
results.extend([copy.deepcopy(o) for x in xrange(n)])
return results
nullstrat = lambda x, y: 0
def nuestrat(x, y):
q = random.random()
if q < .75:
return 0
elif q < .95:
return 2
else:
return 1
#KOMRAGE
T1 = Obj([0.5,0.5],[0.0,0.0],1.0,1.0,makestrat(0.3), side = 'K', id = 'T1')
T2 = Obj([0.5,0.5],[0.2,0.2],2.0,2.0,makestrat(0.75), side = 'K', id = 'T2')
TN = Obj([0.5,1.5],[0.4,0.4],2.0,5.0,makestrat(1.0,2.0), side = 'K', id = 'TN')
TM = Obj([1.5,0.5],[0.4,0.4],2.0,5.0,makestrat(1.0,2.0), side = 'K', id = 'TM')
TQ = Obj([0.5,0.5],[0.5,0.5],5.0,7.0,makestrat(3.0,2.5), side = 'K', id = 'TQ')
TX = Obj([5.0,0.5],[0.5,0.5],3.0,5.0,makestrat(2.0,2.0), side = 'K', id = 'TX')
TY = Obj([0.5,5.0],[0.5,0.5],3.0,5.0,makestrat(2.0,2.0), side = 'K', id = 'TY')
Kom = lincom({T1:66, T2:80, TN:8, TM:8, TQ:15, TX:4, TY:4})
#KALASSAK
AS = Obj([5.,2.],[4.,2.],13.8944,80, nuestrat, side = 'N', id = 'AS')
Nue = lincom({AS:1})
#DARVINCE
needle = Obj([0.1,0.1],[0.2,0.2], 1.0, 1.0, makestrat(maxtake = 0.5), side = 'D', id = 'needle')
boulder = Obj([0.3, 0.3],[1.0,1.0], 2.0, 25.0, nullstrat, side = 'D', id = 'boulder')
Dar = lincom({needle: 484, boulder: 10})
#FIAH
spider = Obj([1.0,0.0],[0.0,0.0],1.0,1E-300, nullstrat, side = 'F', id = 'spider')
Fiah = lincom({spider: 888})
#BLA
Meat = Obj([0.0,0.0],[0.0,0.0],0.0,1.3, nullstrat, side = 'B', id = 'meatshield')
Sold = Obj([1.0,1.0],[1.0,1.0],2.0,10.0, makestrat(maxtake = 0.24), side = 'B', id = 'soldier')
Cann = Obj([1.0,3.0],[1.0,1.0],5.0,35.0, makestrat(maxtake = 1.9), side = 'B', id = 'cannon')
Gene = Obj([0.0,0.0],[2.0,2.0],2.0,50.0, makestrat(maxtake = 4.9), side = 'B', id = 'general')
Char = Obj([0.0,0.0],[0.0,0.0],1.0,5.0, nullstrat, side = 'B', id = 'charger')
Bla = lincom({Meat:472, Sold: 10, Cann: 2, Gene: 1, Char: 60})
#BLOTZ
best = Obj([0.1,0.1],[0.1,0.1],0.1,0.11, nullstrat, side = 'Z', id = 'best')
Bong = lincom({best:1965})
def checkcost(objs):
return sum((o.getcost() for o in objs))
assert checkcost(Kom) < 1000
assert checkcost(Nue) < 1000
assert checkcost(Dar) < 1000
assert checkcost(Fiah) < 1000
assert checkcost(Bla) < 1000
assert checkcost(Bong) < 1000