WinnerMaxBid

This commit is contained in:
Kistaro Windrider 2023-11-18 18:09:40 -08:00
parent 91ebe9ddc3
commit 0f0349810f
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -5,7 +5,7 @@ import (
"strconv" "strconv"
) )
/// Digits of precision in floating-point values in CSVs. // Digits of precision in floating-point values in CSVs.
const CSVPrecision = 10 const CSVPrecision = 10
/** /**
@ -18,6 +18,8 @@ type ResultSummary struct {
Price float64 Price float64
/// The amount of value the winner actually got out of the auctioned item. /// The amount of value the winner actually got out of the auctioned item.
WinnerValue float64 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 * The amount by which the winner's value of the item exceeded the price
* they paid. Often negative. * they paid. Often negative.
@ -79,6 +81,7 @@ func Summarize(price float64, allBidders []Bidder) *ResultSummary {
Bidders: len(allBidders), Bidders: len(allBidders),
Price: price, Price: price,
WinnerValue: winner.Value, WinnerValue: winner.Value,
WinnerMaxBid: winner.BidCeiling(),
WinnerProfit: winner.Value - price, WinnerProfit: winner.Value - price,
LosersWithRegrets: regrets, LosersWithRegrets: regrets,
HighestValue: maxValue, HighestValue: maxValue,
@ -98,6 +101,7 @@ func ResultSummaryCSVHeader() []string {
"Bidders", "Bidders",
"Price", "Price",
"WinnerValue", "WinnerValue",
"WinnerMaxBid",
"WinnerProfit", "WinnerProfit",
"LosersWithRegrets", "LosersWithRegrets",
"HighestValue", "HighestValue",
@ -121,6 +125,7 @@ func (s *ResultSummary) CSVRecord() []string {
strconv.Itoa(s.Bidders), strconv.Itoa(s.Bidders),
csvFloat(s.Price), csvFloat(s.Price),
csvFloat(s.WinnerValue), csvFloat(s.WinnerValue),
csvFloat(s.WinnerMaxBid),
csvFloat(s.WinnerProfit), csvFloat(s.WinnerProfit),
strconv.Itoa(s.LosersWithRegrets), strconv.Itoa(s.LosersWithRegrets),
csvFloat(s.HighestValue), csvFloat(s.HighestValue),