]> git.scottworley.com Git - planeteer/commitdiff
Only print two significant figures for arms costs
authorScott Worley <sworley@chkno.net>
Mon, 17 Sep 2012 05:36:47 +0000 (22:36 -0700)
committerScott Worley <sworley@chkno.net>
Mon, 17 Sep 2012 05:36:47 +0000 (22:36 -0700)
planeteer.go

index 71a85dc9158e235dd508cf6fd1ebe18e59682c61..c17496de0f740897f5e79fa7c13cba3f05429952 100644 (file)
@@ -633,14 +633,14 @@ func FighterAndShieldCost(data planet_data, dims LogicalIndex, table []State, be
                final_state[BuyFighters] = 0
                alt_best := FindBestState(data, dims, table, final_state)
                cost := table[alt_best].value - table[best].value
-               fmt.Println("\rDrones were", float64(cost)/float64(*drones), "each")
+               fmt.Printf("\rDrones were %.2f each\n", float64(cost)/float64(*drones))
        }
        if *batteries > 0 {
                final_state := FinalState(dims)
                final_state[BuyShields] = 0
                alt_best := FindBestState(data, dims, table, final_state)
                cost := table[alt_best].value - table[best].value
-               fmt.Println("\rBatteries were", float64(cost)/float64(*batteries), "each")
+               fmt.Printf("\rBatteries were %.2f each\n", float64(cost)/float64(*batteries))
        }
 }