]> git.scottworley.com Git - planeteer/commitdiff
--tomorrow_weight feature, with data
authorScott Worley <sworley@chkno.net>
Sat, 3 Dec 2011 22:31:56 +0000 (14:31 -0800)
committerScott Worley <sworley@chkno.net>
Sat, 3 Dec 2011 22:31:56 +0000 (14:31 -0800)
planet-data
planeteer.go

index 4ef240b51ada10d7c56f6d34d284be46a573ebe6..9edd4371b4e3f3f726d1ee7f250c2489ad55d174 100644 (file)
@@ -94,6 +94,7 @@
        "Planets": {
                "Earth": {
                        "BeaconOn": true,
        "Planets": {
                "Earth": {
                        "BeaconOn": true,
+                       "TomorrowValue": 4472,
                        "RelativePrices": {
                                "Shield Batterys":            100,
                                "Device Of Cloakings":        100,
                        "RelativePrices": {
                                "Shield Batterys":            100,
                                "Device Of Cloakings":        100,
                },
                "Hothor": {
                        "BeaconOn": true,
                },
                "Hothor": {
                        "BeaconOn": true,
+                       "TomorrowValue": 3789,
                        "RelativePrices": {
                                "Shield Batterys":            176,
                                "Device Of Cloakings":        112,
                        "RelativePrices": {
                                "Shield Batterys":            176,
                                "Device Of Cloakings":        112,
                },
                "Volcana": {
                        "BeaconOn": false,
                },
                "Volcana": {
                        "BeaconOn": false,
+                       "TomorrowValue": 4330,
                        "RelativePrices": {
                                "Device Of Cloakings":        187,
                                "Medical Units":              143,
                        "RelativePrices": {
                                "Device Of Cloakings":        187,
                                "Medical Units":              143,
                },
                "Metallica": {
                        "BeaconOn": true,
                },
                "Metallica": {
                        "BeaconOn": true,
+                       "TomorrowValue": 4757,
                        "RelativePrices": {
                                "Shield Batterys":            67,
                                "Device Of Cloakings":        78,
                        "RelativePrices": {
                                "Shield Batterys":            67,
                                "Device Of Cloakings":        78,
                },
                "Medoca": {
                        "BeaconOn": true,
                },
                "Medoca": {
                        "BeaconOn": true,
+                       "TomorrowValue": 3968,
                        "RelativePrices": {
                                "Medical Units":              23,
                                "Ice Units":                  124,
                        "RelativePrices": {
                                "Medical Units":              23,
                                "Ice Units":                  124,
                },
                "Gojuon": {
                        "BeaconOn": true,
                },
                "Gojuon": {
                        "BeaconOn": true,
+                       "TomorrowValue": 3813,
                        "RelativePrices": {
                                "Heating Units":              99,
                                "Ice Units":                  1187,
                        "RelativePrices": {
                                "Heating Units":              99,
                                "Ice Units":                  1187,
                },
                "Desha Rockna": {
                        "BeaconOn": true,
                },
                "Desha Rockna": {
                        "BeaconOn": true,
+                       "TomorrowValue": 3908,
                        "RelativePrices": {
                                "Medical Units":              134,
                                "Heating Units":              124,
                        "RelativePrices": {
                                "Medical Units":              134,
                                "Heating Units":              124,
                },
                "Dogafetch": {
                        "BeaconOn": true,
                },
                "Dogafetch": {
                        "BeaconOn": true,
+                       "TomorrowValue": 4137,
                        "RelativePrices": {
                                "Shield Batterys":            123,
                                "Device Of Cloakings":        67,
                        "RelativePrices": {
                                "Shield Batterys":            123,
                                "Device Of Cloakings":        67,
                },
                "Eden": {
                        "BeaconOn": false,
                },
                "Eden": {
                        "BeaconOn": false,
+                       "TomorrowValue": 20036,
                        "RelativePrices": {
                                "Medical Units":              100,
                                "Tree Growth Kits":           11,
                        "RelativePrices": {
                                "Medical Units":              100,
                                "Tree Growth Kits":           11,
                },
                "Richiana": {
                        "BeaconOn": true,
                },
                "Richiana": {
                        "BeaconOn": true,
+                       "TomorrowValue": 1908,
                        "RelativePrices": {
                                "Device Of Cloakings":        157,
                                "Medical Units":              654,
                        "RelativePrices": {
                                "Device Of Cloakings":        157,
                                "Medical Units":              654,
                },
                "Tribonia": {
                        "BeaconOn": true,
                },
                "Tribonia": {
                        "BeaconOn": true,
+                       "TomorrowValue": 3837,
                        "RelativePrices": {
                                "Medical Units":              187,
                                "Heating Units":              345,
                        "RelativePrices": {
                                "Medical Units":              187,
                                "Heating Units":              345,
                },
                "Dune": {
                        "BeaconOn": true,
                },
                "Dune": {
                        "BeaconOn": true,
+                       "TomorrowValue": 3674,
                        "RelativePrices": {
                                "Shield Batterys":            143,
                                "Device Of Cloakings":        176,
                        "RelativePrices": {
                                "Shield Batterys":            143,
                                "Device Of Cloakings":        176,
                },
                "Plague": {
                        "BeaconOn": true,
                },
                "Plague": {
                        "BeaconOn": true,
+                       "TomorrowValue": 4052,
                        "RelativePrices": {
                                "Medical Units":              239,
                                "Heating Units":              88,
                        "RelativePrices": {
                                "Medical Units":              239,
                                "Heating Units":              88,
                },
                "Norhaven": {
                        "BeaconOn": true,
                },
                "Norhaven": {
                        "BeaconOn": true,
+                       "TomorrowValue": 4517,
                        "RelativePrices": {
                                "Shield Batterys":            100,
                                "Device Of Cloakings":        88,
                        "RelativePrices": {
                                "Shield Batterys":            100,
                                "Device Of Cloakings":        88,
                },
                "Loony": {
                        "BeaconOn": true,
                },
                "Loony": {
                        "BeaconOn": true,
+                       "TomorrowValue": 3360,
                        "RelativePrices": {
                                "Shield Batterys":            500,
                                "Device Of Cloakings":        55,
                        "RelativePrices": {
                                "Shield Batterys":            500,
                                "Device Of Cloakings":        55,
                },
                "WeaponWorld": {
                        "BeaconOn": true,
                },
                "WeaponWorld": {
                        "BeaconOn": true,
+                       "TomorrowValue": 4623,
                        "RelativePrices": {
                                "Shield Batterys":            100,
                                "Device Of Cloakings":        98,
                        "RelativePrices": {
                                "Shield Batterys":            100,
                                "Device Of Cloakings":        98,
                },
                "Zoolie": {
                        "BeaconOn": true,
                },
                "Zoolie": {
                        "BeaconOn": true,
+                       "TomorrowValue": 3802,
                        "RelativePrices": {
                                "Medical Units":              78,
                                "Heating Units":              344,
                        "RelativePrices": {
                                "Medical Units":              78,
                                "Heating Units":              344,
                },
                "Baboria": {
                        "BeaconOn": true,
                },
                "Baboria": {
                        "BeaconOn": true,
+                       "TomorrowValue": 3869,
                        "RelativePrices": {
                                "Medical Units":              100,
                                "Heating Units":              122,
                        "RelativePrices": {
                                "Medical Units":              100,
                                "Heating Units":              122,
                },
                "StockWorld": {
                        "BeaconOn": true,
                },
                "StockWorld": {
                        "BeaconOn": true,
+                       "TomorrowValue": 4462,
                        "RelativePrices": {
                                "Shield Batterys":            103,
                                "Device Of Cloakings":        102,
                        "RelativePrices": {
                                "Shield Batterys":            103,
                                "Device Of Cloakings":        102,
                },
                "HugeLind Mar": {
                        "BeaconOn": true,
                },
                "HugeLind Mar": {
                        "BeaconOn": true,
+                       "TomorrowValue": 3563,
                        "RelativePrices": {
                                "Device Of Cloakings":        123,
                                "Medical Units":              117,
                        "RelativePrices": {
                                "Device Of Cloakings":        123,
                                "Medical Units":              117,
                },
                "Sickonia": {
                        "BeaconOn": true,
                },
                "Sickonia": {
                        "BeaconOn": true,
+                       "TomorrowValue": 2892,
                        "RelativePrices": {
                                "Medical Units":              1756,
                                "Heating Units":              100,
                        "RelativePrices": {
                                "Medical Units":              1756,
                                "Heating Units":              100,
                },
                "Schooloria": {
                        "BeaconOn": false,
                },
                "Schooloria": {
                        "BeaconOn": false,
+                       "TomorrowValue": 3554,
                        "RelativePrices": {
                                "Heating Units":              100,
                                "Ice Units":                  100,
                        "RelativePrices": {
                                "Heating Units":              100,
                                "Ice Units":                  100,
                },
                "Uniland": {
                        "BeaconOn": false,
                },
                "Uniland": {
                        "BeaconOn": false,
+                       "TomorrowValue": 0,
                        "RelativePrices": {
                        }
                },
                "HomeWorld": {
                        "BeaconOn": true,
                        "RelativePrices": {
                        }
                },
                "HomeWorld": {
                        "BeaconOn": true,
+                       "TomorrowValue": 3005,
                        "RelativePrices": {
                                "Medical Units":              1783,
                                "Heating Units":              232,
                        "RelativePrices": {
                                "Medical Units":              1783,
                                "Heating Units":              232,
                },
                "Dreamora": {
                        "BeaconOn": true,
                },
                "Dreamora": {
                        "BeaconOn": true,
+                       "TomorrowValue": 4046,
                        "RelativePrices": {
                                "Device Of Cloakings":        123,
                                "Medical Units":              87,
                        "RelativePrices": {
                                "Device Of Cloakings":        123,
                                "Medical Units":              87,
                },
                "Nirvana": {
                        "BeaconOn": false,
                },
                "Nirvana": {
                        "BeaconOn": false,
+                       "TomorrowValue": 4705,
                        "RelativePrices": {
                                "Device Of Cloakings":        67,
                                "AntiCloak Scanners":         92,
                        "RelativePrices": {
                                "Device Of Cloakings":        67,
                                "AntiCloak Scanners":         92,
index a707d589d11778890efc81cb73b5f2a31346278a..f4a64aae23449c055b8b3e9d2b8ccb1143d51323 100644 (file)
@@ -65,6 +65,9 @@ var battery_price = flag.Int("battery_price", 0, "Today's Shield Battery price")
 var visit_string = flag.String("visit", "",
        "A comma-separated list of planets to make sure to visit")
 
 var visit_string = flag.String("visit", "",
        "A comma-separated list of planets to make sure to visit")
 
+var tomorrow_weight = flag.Float64("tomorrow_weight", 1.0,
+       "Weight for the expected value of tomorrow's trading.  0.0 - 1.0")
+
 var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
 
 var visit_cache []string
 var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
 
 var visit_cache []string
@@ -113,8 +116,9 @@ type Commodity struct {
        Limit     int
 }
 type Planet struct {
        Limit     int
 }
 type Planet struct {
-       BeaconOn bool
-       Private  bool
+       BeaconOn      bool
+       Private       bool
+       TomorrowValue int
        /* Use relative prices rather than absolute prices because you
           can get relative prices without traveling to each planet. */
        RelativePrices map[string]int
        /* Use relative prices rather than absolute prices because you
           can get relative prices without traveling to each planet. */
        RelativePrices map[string]int
@@ -542,16 +546,19 @@ func FindBestState(data planet_data, dims []int, table []State) int32 {
        addr[Hold] = 0
        addr[UnusedCargo] = 0
        max_index := int32(-1)
        addr[Hold] = 0
        addr[UnusedCargo] = 0
        max_index := int32(-1)
-       max_value := int32(0)
+       max_value := 0.0
        max_fuel := 1
        if *fuel == 0 {
                max_fuel = 0
        }
        for addr[Fuel] = 0; addr[Fuel] <= max_fuel; addr[Fuel]++ {
                for addr[Location] = 0; addr[Location] < dims[Location]; addr[Location]++ {
        max_fuel := 1
        if *fuel == 0 {
                max_fuel = 0
        }
        for addr[Fuel] = 0; addr[Fuel] <= max_fuel; addr[Fuel]++ {
                for addr[Location] = 0; addr[Location] < dims[Location]; addr[Location]++ {
-                       if len(end()) == 0 || end()[data.i2p[addr[Location]]] {
+                       planet := data.i2p[addr[Location]]
+                       if len(end()) == 0 || end()[planet] {
                                index := EncodeIndex(dims, addr)
                                index := EncodeIndex(dims, addr)
-                               value := CellValue(data, dims, table, addr)
+                               today_value := CellValue(data, dims, table, addr)
+                               tomorrow_value := *tomorrow_weight * float64(*hold+data.Planets[planet].TomorrowValue)
+                               value := float64(today_value) + tomorrow_value
                                if value > max_value {
                                        max_value = value
                                        max_index = index
                                if value > max_value {
                                        max_value = value
                                        max_index = index