]> git.scottworley.com Git - planeteer/commitdiff
Consider not using all the fuel.
authorScott Worley <sworley@chkno.net>
Thu, 24 Nov 2011 07:10:20 +0000 (23:10 -0800)
committerScott Worley <sworley@chkno.net>
Thu, 24 Nov 2011 07:18:11 +0000 (23:18 -0800)
planeteer.go

index e9f10c7595b13fc863ea68801b90e0b972b40c39..a3a5a029add7dd798fe37624c8dddc61f68f3dcb 100644 (file)
@@ -584,15 +584,17 @@ func FindBestState(data planet_data, dims []int, table []State) int {
        addr[BuyFighters] = dims[BuyFighters] - 1
        addr[BuyShields] = dims[BuyShields] - 1
        addr[Visit] = dims[Visit] - 1
        addr[BuyFighters] = dims[BuyFighters] - 1
        addr[BuyShields] = dims[BuyShields] - 1
        addr[Visit] = dims[Visit] - 1
-       // Fuel, Hold, UnusedCargo left at 0
+       // Hold and UnusedCargo left at 0
        max_index := -1
        max_value := 0
        max_index := -1
        max_value := 0
-       for addr[Location] = 0; addr[Location] < dims[Location]; addr[Location]++ {
-               if len(end()) == 0 || end()[data.i2p[addr[Location]]] {
-                       index := EncodeIndex(dims, addr)
-                       if table[index].value > max_value {
-                               max_value = table[index].value
-                               max_index = index
+       for addr[Fuel] = 0; addr[Fuel] < 2; addr[Fuel]++ {
+               for addr[Location] = 0; addr[Location] < dims[Location]; addr[Location]++ {
+                       if len(end()) == 0 || end()[data.i2p[addr[Location]]] {
+                               index := EncodeIndex(dims, addr)
+                               if table[index].value > max_value {
+                                       max_value = table[index].value
+                                       max_index = index
+                               }
                        }
                }
        }
                        }
                }
        }