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"
)
/// 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),