contd.py: fix condition direction, separate costs/rewards/freight legs
PAYMENT/REPUTATION always go to the player; PROVISION_SHIPMENT (a cost) and PICKUP/DELIVERY_SHIPMENT (a freight leg the player may or may not fly) depend on the condition's own Party field vs the contract's Party, not a flat assumption that every material condition is something the player buys. Net now correctly adds COMEX_PURCHASE_PICKUP rewards instead of only subtracting provisioning costs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+16
-11
@@ -1,10 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
"""List this account's OPEN CONTD contract offers (the NPC logistics-officer pool shown in APEX's
|
||||
CONTD panel - usually 3 at a time, only one acceptable) with payment, priced material requirements,
|
||||
and net. Judging the actual best deal is NOT this tool's job for anything it flags as unpriced
|
||||
(EXPLORATION, REPAIR_SHIP, etc. - see puga/contd.py's docstring) or for situational cheapness (a ship
|
||||
already flying that route, material already in free/uncommitted storage) - it reports the breakdown,
|
||||
the caller reasons about context.
|
||||
CONTD panel - usually 3 at a time, only one acceptable) with payment, materials received/supplied,
|
||||
freight legs the player must personally fly, and net (see puga/contd.py's docstring for exactly
|
||||
which condition types are costs vs rewards vs the player's own job). Judging the actual best deal
|
||||
is NOT this tool's job for anything it flags as unpriced (EXPLORATION, REPAIR_SHIP, etc.) or for
|
||||
a freight leg's real fuel cost (flagged with weight/volume, price via puga.shipping yourself) - it
|
||||
reports the breakdown, the caller reasons about context.
|
||||
|
||||
puga contd
|
||||
puga contd --cx AI1
|
||||
@@ -30,18 +31,22 @@ def main():
|
||||
print(f"\n{r['id']} partner={r['partner']} deadline {r['deadline_days']:.1f}d"
|
||||
+ (" +reputation" if r["reputation"] else ""))
|
||||
print(f" payment: {r['payment']:,.2f} AIC")
|
||||
for req in r["requirements"]:
|
||||
flag = " SHORT: book can't fill this qty" if req["short"] else ""
|
||||
print(f" requires: {req['ticker']} x{req['qty']:g} @ {req['address']} buy-fresh cost {req['cost']:,.0f}{flag}")
|
||||
for rew in r["rewards"]:
|
||||
print(f" receives: {rew['ticker']} x{rew['qty']:g} @ {rew['address']} market value {rew['value']:,.0f}")
|
||||
for cost in r["costs"]:
|
||||
flag = " SHORT: book can't fill this qty" if cost["short"] else ""
|
||||
print(f" must supply: {cost['ticker']} x{cost['qty']:g} @ {cost['address']} buy-fresh cost {cost['value']:,.0f}{flag}")
|
||||
for ltype, addr, wgt, vol in r["freight_legs"]:
|
||||
print(f" YOUR FREIGHT LEG: {ltype} @ {addr} {wgt:g}t / {vol:g}m3 - price via puga.shipping, not included in net")
|
||||
for ftype, addr in r["flags"]:
|
||||
print(f" UNPRICED CONDITION: {ftype}" + (f" @ {addr}" if addr else "") + " - context-dependent, judge separately")
|
||||
print(f" material cost: {r['material_cost']:,.0f} -> net (payment - buy-fresh cost): {r['net']:,.0f}")
|
||||
print(f" reward value: {r['reward_value']:,.0f} cost value: {r['cost_value']:,.0f} -> net (payment + reward - cost): {r['net']:,.0f}")
|
||||
|
||||
priceable = [c for c in contracts if not contd.evaluate(c, a.cx)["flags"]]
|
||||
if len(priceable) == len(contracts):
|
||||
best = max(contracts, key=lambda c: contd.evaluate(c, a.cx)["net"])
|
||||
print(f"\nby buy-fresh net alone, best priced: {best['ContractLocalId']}"
|
||||
" - but check storage for materials you may already hold before trusting this")
|
||||
print(f"\nby payment+reward net alone, best priced: {best['ContractLocalId']}"
|
||||
" - unpriced/flagged conditions (freight legs, exploration, etc.) still need judgment")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user