Compare commits

..

No commits in common. "0a7dd54597009a7519820131a97ab3e271f67ecd" and "f151a9ad766d1839f2418bc1bdf3c98d9744947b" have entirely different histories.

View File

@ -1,43 +0,0 @@
package main
import (
"fmt"
"log"
"os"
"strconv"
"git.chromaticdragon.app/kistaro/auctionsim/auctionsim"
)
func main() {
num := 1000
if len(os.Args) > 1 {
n, err := strconv.ParseInt(os.Args[1], 0, 64)
if err != nil {
log.Fatalf("can't parse %q as a number of bidders: %v", os.Args[1], err)
}
num = n
}
if num <= 1 {
log.Fatalf("can't run an auction with %d bidders", num)
}
price, bidder := auctionsim.RunAuction(
auctionsim.CappedBidderGenerator{
G: auctionsim.NormalestBidderGenerator(),
Lim: num,
},
)
delta := bidder.Value - price
valueStr := "gaining nothing"
if delta > 0 {
valueStr = fmt.Sprintf("gaining ¤%f", delta)
}
if delta < 0 {
valueStr = fmt.Sprintf("losing ¤%f", -delta)
}
fmt.Printf("The auction winner paid ¤%f, %s.\n", price, valueStr)
fmt.Printf("The item was worth ¤%f to them.\n", bidder.Value)
fmt.Printf("They would have paid up to ¤%f for it.\n", bidder.BidCeiling())
}