WinnerMaxBid
This commit is contained in:
parent
91ebe9ddc3
commit
0f0349810f
@ -5,7 +5,7 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
/// Digits of precision in floating-point values in CSVs.
|
||||
// Digits of precision in floating-point values in CSVs.
|
||||
const CSVPrecision = 10
|
||||
|
||||
/**
|
||||
@ -18,6 +18,8 @@ type ResultSummary struct {
|
||||
Price float64
|
||||
/// The amount of value the winner actually got out of the auctioned item.
|
||||
WinnerValue float64
|
||||
/// The highest bid the auction winner was willing to make.
|
||||
WinnerMaxBid float64
|
||||
/**
|
||||
* The amount by which the winner's value of the item exceeded the price
|
||||
* they paid. Often negative.
|
||||
@ -79,6 +81,7 @@ func Summarize(price float64, allBidders []Bidder) *ResultSummary {
|
||||
Bidders: len(allBidders),
|
||||
Price: price,
|
||||
WinnerValue: winner.Value,
|
||||
WinnerMaxBid: winner.BidCeiling(),
|
||||
WinnerProfit: winner.Value - price,
|
||||
LosersWithRegrets: regrets,
|
||||
HighestValue: maxValue,
|
||||
@ -98,6 +101,7 @@ func ResultSummaryCSVHeader() []string {
|
||||
"Bidders",
|
||||
"Price",
|
||||
"WinnerValue",
|
||||
"WinnerMaxBid",
|
||||
"WinnerProfit",
|
||||
"LosersWithRegrets",
|
||||
"HighestValue",
|
||||
@ -121,6 +125,7 @@ func (s *ResultSummary) CSVRecord() []string {
|
||||
strconv.Itoa(s.Bidders),
|
||||
csvFloat(s.Price),
|
||||
csvFloat(s.WinnerValue),
|
||||
csvFloat(s.WinnerMaxBid),
|
||||
csvFloat(s.WinnerProfit),
|
||||
strconv.Itoa(s.LosersWithRegrets),
|
||||
csvFloat(s.HighestValue),
|
||||
|
Loading…
Reference in New Issue
Block a user