Skip to content

Commit

Permalink
Added optional capcaity parameter to getBestHopFrom
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Aug 6, 2014
1 parent ced8c73 commit a6803b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tradecalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ def getBestTrade(self, src, dst, startCr, capacity=None):
# Get a list of what we can buy
return self.tryCombinations(startCr, src.links[dst.ID], capacity=capacity)

def getBestHopFrom(self, src, credits):
def getBestHopFrom(self, src, credits, capacity=None):
""" Determine the best trade run from a given station. """
if isinstance(src, str):
src = self.tdb.getStation(src)
bestDst, bestLoad, bestGainCr = None, None, 0
for dst in src.stations:
trade = self.getBestTrade(src, dst, credits)
trade = self.getBestTrade(src, dst, credits, capacity=capacity)
if trade and trade[1] > bestGainCr:
bestDst, bestLoad, bestGainCr = dst, trade[0], trade[1]
return bestDst, bestLoad, bestGainCr
Expand Down

0 comments on commit a6803b5

Please sign in to comment.