Skip to content

Commit

Permalink
Fixed handling of the case where no links are available in getBestTrade
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Aug 6, 2014
1 parent ef363ac commit 4e5d6fd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tradecalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ def tryCombinations(self, startCr, tradeList, capacity=None):

def getBestTrade(self, src, dst, startCr, capacity=None):
if self.debug: print("# %s -> %s with %dcr" % (src, dst, startCr))
if not dst in src.stations:
raise ValueError("%s does not have a link to %s" % (src, dst))

# Get a list of what we can buy
return self.tryCombinations(startCr, src.links[dst.ID], capacity=capacity)
return self.tryCombinations(startCr, src.links[dst.ID], capacity)

def getBestHopFrom(self, src, credits, capacity=None):
""" Determine the best trade run from a given station. """
Expand Down

0 comments on commit 4e5d6fd

Please sign in to comment.