From ddef04ab661444f478e4602ba57784a4636f32ab Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Wed, 23 Nov 2011 23:10:20 -0800 Subject: [PATCH] Consider not using all the fuel. --- planeteer.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/planeteer.go b/planeteer.go index e9f10c7..a3a5a02 100644 --- a/planeteer.go +++ b/planeteer.go @@ -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 - // Fuel, Hold, UnusedCargo left at 0 + // Hold and UnusedCargo left at 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 + } } } } -- 2.44.1