Skip to content

Commit

Permalink
Merged kfsone/tradedangerous into master
Browse files Browse the repository at this point in the history
  • Loading branch information
maddavo committed Dec 15, 2014
2 parents e1f2249 + 5292359 commit 2139508
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014
==============================================================================

v6.2.2 [wip]
. (kfsone) Added "--max-days" to run command
+ Stations, ships: kfsone

v6.2.1 Dec 12 2014
. (kfsone) Added "olddata" command
. (kfsone) "run" (with -vv) will now show data age
Expand Down
13 changes: 7 additions & 6 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ RUN sub-command:
--via Enterprise
--via Chango

--max-days-old N.NN
-MD N.NN
Filters out price data that exceeds a specified age in days
e.g.
--max-days-old 7 (data less than a week old)
-MD=2 (data less than 2 days old)

--unique
--uni
Only show routes which do not visit any station twice
Expand All @@ -240,12 +247,6 @@ RUN sub-command:
e.g.
-jumps-per 5

--start-jumps N
-s N
[Requires --from]
Include stations within N jumps of the start system as potential
starting locations.

--avoid ITEM/SYSTEM/STATION
--avoid AVOID,AVOID,...,AVOID
--av ITEM/SYSTEM/STATION
Expand Down
6 changes: 6 additions & 0 deletions commands/run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@
metavar='N',
type=int,
),
ParseArgument('--max-days-old', '-MD',
help='Maximum age (in days) of trade data to use.',
metavar='DAYS',
type=float,
dest='maxAge',
),
ParseArgument('--unique',
help='Only visit each station once.',
action='store_true',
Expand Down
40 changes: 40 additions & 0 deletions data/ShipVendor.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
unq:[email protected]_id,unq:[email protected]_id,unq:[email protected]_id,cost
'Aiabiko','White Orbital','Anaconda',146969451
'Aiabiko','White Orbital','Asp Explorer',6661153
'Aiabiko','White Orbital','Dropship',37814205
'Aiabiko','White Orbital','Eagle',44800
'Aiabiko','White Orbital','Hauler',52720
'Aiabiko','White Orbital','Lakon Type 6',1045945
'Aiabiko','White Orbital','Lakon Type 7',17472252
'Aiabiko','White Orbital','Sidewinder',32000
'Djendelis','Atwater Enterprise','Adder',87808
'Djendelis','Atwater Enterprise','Cobra',379718
'Djendelis','Atwater Enterprise','Dropship',37814205
'Djendelis','Atwater Enterprise','Eagle',44800
'Djendelis','Atwater Enterprise','Hauler',52720
'Djendelis','Atwater Enterprise','Lakon Type 6',1045945
'Djendelis','Atwater Enterprise','Lakon Type 7',17472252
'Djendelis','Atwater Enterprise','Lakon Type 9',76555842
'Djendelis','Atwater Enterprise','Sidewinder',32000
'Djendelis','Atwater Enterprise','Viper',142931
'Eravate','Ackerman Market','Eagle',44800
'Eravate','Ackerman Market','Hauler',52720
'Eravate','Ackerman Market','Lakon Type 6',1045945
Expand All @@ -13,6 +31,28 @@ unq:[email protected]_id,unq:[email protected]_id,unq:[email protected]_id,cos
'Eravate','Russell Ring','Hauler',52720
'Eravate','Russell Ring','Lakon Type 6',1045945
'Eravate','Russell Ring','Sidewinder',32000
'Gong Gu','Kelly Dock','Adder',87808
'Gong Gu','Kelly Dock','Asp Explorer',6661153
'Gong Gu','Kelly Dock','Cobra',379718
'Gong Gu','Kelly Dock','Dropship',37814205
'Gong Gu','Kelly Dock','Eagle',44800
'Gong Gu','Kelly Dock','Hauler',52720
'Gong Gu','Kelly Dock','Lakon Type 6',1045945
'Gong Gu','Kelly Dock','Lakon Type 7',17472252
'Gong Gu','Kelly Dock','Lakon Type 9',76555842
'Gong Gu','Kelly Dock','Python',56978179
'Gong Gu','Kelly Dock','Sidewinder',32000
'Gong Gu','Kelly Dock','Viper',142931
'HIP 87369','Carey Port','Adder',87808
'HIP 87369','Carey Port','Asp Explorer',6661153
'HIP 87369','Carey Port','Cobra',379718
'HIP 87369','Carey Port','Dropship',37814205
'HIP 87369','Carey Port','Eagle',44800
'HIP 87369','Carey Port','Hauler',52720
'HIP 87369','Carey Port','Lakon Type 6',1045945
'HIP 87369','Carey Port','Lakon Type 7',17472252
'HIP 87369','Carey Port','Sidewinder',32000
'HIP 87369','Carey Port','Viper',142931
'LFT 1448','Dirac Enterprise','Anaconda',146969451
'LFT 1448','Dirac Enterprise','Asp Explorer',6661153
'LFT 1448','Dirac Enterprise','Cobra',379718
Expand Down
19 changes: 17 additions & 2 deletions data/Station.csv
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ unq:[email protected]_id,unq:name,ls_from_star
'Diso','Shifnalport',0.0
'Djaujang','Cochrane Refinery',0.0
'Djaujang','Martins Prospect',0.0
'Djendelis','Atwater Enterprise',272.0
'Djendelis','Faris Ring',376.0
'Djendelis','Simonyi City',498.0
'Doris','Isherwood Dock',0.0
'DT Virginis','Chun Vision',0.0
'Duamta','Davis Terminal',0.0
Expand Down Expand Up @@ -360,7 +363,9 @@ unq:[email protected]_id,unq:name,ls_from_star
'Ethgreze','Bloch Station',0.0
'Euryale','Eg Main Hq',0.0
'Euryale','Gantt Enterprise',0.0
'Evergreen','Stafford Terminal',0.0
'Evergreen','Forsskal Hub',112.0
'Evergreen','Kazantsev Ring',144.0
'Evergreen','McCaffrey Enterprise',144.0
'Farowalan','Bamford City',0.0
'Feng Huang','Murdoch Plant',0.0
'Finteno','Kolmogorov Station',0.0
Expand Down Expand Up @@ -427,7 +432,7 @@ unq:[email protected]_id,unq:name,ls_from_star
'Gnowee','Abasheli City',0.0
'Gnowee','Kelleam Port',0.0
'Gondul','Fiorilla Dock',0.0
'Gong Gu','Cheli Dock',0.0
'Gong Gu','Kelly Dock',702.0
'Gorgon','Brandenstein Station',0.0
'Gorgon','Burnet City',0.0
'Gorgon','Ray Hub',0.0
Expand Down Expand Up @@ -504,6 +509,9 @@ unq:[email protected]_id,unq:name,ls_from_star
'HIP 74243','Bean City',0.0
'HIP 74255','Guest City',0.0
'HIP 74255','Vela City',0.0
'HIP 87369','Carey Port',1576.0
'HIP 87369','Kerwin Orbital',41426.0
'HIP 87369','Landsteiner Gateway',43763.0
'Ho Hsien','Bushnell Enterprise',670.0
'Ho Hsien','Dutton Station',670.0
'Holiacan','Hopi',0.0
Expand Down Expand Up @@ -678,6 +686,7 @@ unq:[email protected]_id,unq:name,ls_from_star
'LHS 295','White Settlement',0.0
'LHS 3006','WCM Transfer Orbital',0.0
'LHS 3057','Wallace Colony',0.0
'LHS 3197','Szilard Orbital',97.0
'LHS 3262','Lacaille Prospect',0.0
'LHS 331','Hopkinson City',0.0
'LHS 332','Pelt Penal Colony',0.0
Expand Down Expand Up @@ -725,6 +734,8 @@ unq:[email protected]_id,unq:name,ls_from_star
'LHS 5072','Northrop Dock',0.0
'LHS 5287','McArthur''s Reach',0.0
'LHS 531','Nelson Terminal',0.0
'LHS 54','Nelson Dock',840.0
'LHS 54','Popper Enterprise',1590.0
'LHS 6282','Kendrick Base',0.0
'LHS 6309','Beliaev Port',0.0
'LHS 6309','Bester Terminal',0.0
Expand Down Expand Up @@ -790,6 +801,8 @@ unq:[email protected]_id,unq:name,ls_from_star
'LP 71-157','Buckland Colony',0.0
'LP 732-94','Sellers Hub',0.0
'LP 816-60','Garratt Landing',0.0
'LP 862-184','Mayr Hangar',156.0
'LP 862-184','Winne Plant',106.0
'LP 887-68','Hope Platform',0.0
'LP 903-21','Avdeyev Settlement',0.0
'LP 908-11','Huygens Ring',0.0
Expand Down Expand Up @@ -906,6 +919,8 @@ unq:[email protected]_id,unq:name,ls_from_star
'Mombaluma','Bennett Colony',0.0
'Mombaluma','Hughes-Fulford Terminal',0.0
'Mombaluma','Leavitt Orbital',0.0
'Montet','Seddon Gateway',1542.0
'Montet','Thirsk Enterprise',7772.0
'Morgor','Romanek''s Folly',0.0
'Moroecani','La Cosa Dock',0.0
'Moros','Ellis Port',0.0
Expand Down
8 changes: 7 additions & 1 deletion tradecalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def getBestTrade(self, src, dst, credits=None, fitFunction=None):
if credits is None: credits = tdenv.credits - getattr(tdenv, 'insurance', 0)
capacity = tdenv.capacity
avoidItems = tdenv.avoidItems
self.tdenv.DEBUG0("{}/{} -> {}/{} with {:n}cr",
tdenv.DEBUG0("{}/{} -> {}/{} with {:n}cr",
src.system.dbname, src.dbname,
dst.system.dbname, dst.dbname,
credits)
Expand All @@ -376,6 +376,12 @@ def getBestTrade(self, src, dst, credits=None, fitFunction=None):
items = src.tradingWith[dst]
if avoidItems:
items = [ item for item in items if not item.item in avoidItems ]
if tdenv.maxAge:
# convert from days to seconds
cutoffSeconds = tdenv.maxAge * (24 * 60 * 60)
items = [ item for item in items
if max(item.srcAge, item.dstAge) < cutoffSeconds
]

# Remove any items with less gain (value) than the cheapest item, or that are outside our budget.
# This should reduce the search domain for the majority of cases, especially low-end searches.
Expand Down

0 comments on commit 2139508

Please sign in to comment.