From cbf01f59c3e293e272cb83a35b125c22a9ce499b Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Wed, 2 Nov 2011 15:32:10 -0700 Subject: [PATCH 1/1] Relative prices from the data file are percentages Divide them by 100 before using them. --- planeteer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/planeteer.go b/planeteer.go index 4dbb27b..53f69f1 100644 --- a/planeteer.go +++ b/planeteer.go @@ -319,8 +319,8 @@ func FillCellBySelling(data planet_data, dims []int, table []State, addr []int) continue } base_price := data.Commodities[commodity].BasePrice - absolute_price := relative_price * base_price - sell_price := int(float64(absolute_price) * 0.9) + absolute_price := float64(base_price) * float64(relative_price) / 100.0 + sell_price := int(absolute_price * 0.9) for other[UnusedCargo] = 0; other[UnusedCargo] < dims[UnusedCargo]; other[UnusedCargo]++ { @@ -350,7 +350,7 @@ func FillCellByBuying(data planet_data, dims []int, table []State, addr []int) { return } base_price := data.Commodities[commodity].BasePrice - absolute_price := relative_price * base_price + absolute_price := int(float64(base_price) * float64(relative_price) / 100.0) quantity := *hold - addr[UnusedCargo] total_price := quantity * absolute_price other[Hold] = 0 -- 2.44.1