From 0f0349810f6b83cf4f2ea61916b5c85f4b5df5c3 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sat, 18 Nov 2023 18:09:40 -0800 Subject: [PATCH] WinnerMaxBid --- auctionsim/summary.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/auctionsim/summary.go b/auctionsim/summary.go index cf047f2..2cdb311 100644 --- a/auctionsim/summary.go +++ b/auctionsim/summary.go @@ -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),