go fmt, with some syntax fixes

This commit is contained in:
Kistaro Windrider 2023-11-18 16:27:21 -08:00
parent 0c30e880cc
commit 88737d8f4c
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8
4 changed files with 41 additions and 42 deletions

View File

@ -29,7 +29,6 @@ func RunAuction(g BidderGenerator) (float64, Bidder) {
return prevBid, highBidder
}
/**
* RunAuctionVerbosely simulates a single-bid second-price auction with no
* reserve price between all bidders emitted by the provided generator,
@ -39,7 +38,7 @@ func RunAuction(g BidderGenerator) (float64, Bidder) {
* Use CappedBidderGenerator to limit the size of the auction and therefore
* the number of bidders on the list.
*/
func RunAuctionVerbosely(g BidderGenerator) float64, []Bidder {
func RunAuctionVerbosely(g BidderGenerator) (float64, []Bidder) {
var bidders []Bidder
for b, ok := g.Generate(); ok; b, ok = g.Generate() {
bidders = append(bidders, b)

View File

@ -79,7 +79,7 @@ func (b Bidder) BidCeiling() float64 {
* than their calculated ceiling if they had the money to do so, but they don't.
*/
func (b Bidder) CashCapped() bool {
return b.ValueBelief() > b.Cash;
return b.ValueBelief() > b.Cash
}
/**

View File

@ -12,7 +12,7 @@ type Distribution interface {
* Draw returns the next float64 from the distribution and true, or
* zero and false if the distribution is exhausted or otherwise unusable.
*/
Draw() float64, bool
Draw() (float64, bool)
}
/**
@ -23,7 +23,7 @@ type BidderGenerator interface {
* Generate returns the next Bidder and true, or a zero Bidder and false if
* the generator is exhausted or otherwise unusable.
*/
Generate() Bidder, bool
Generate() (Bidder, bool)
}
/**
@ -53,7 +53,7 @@ func (b *BiddersFromDistributions) Generate() (Bidder, bool) {
return Bidder{}, false
}
return Bidder {
return Bidder{
Value: value,
Irrationality: irrationality,
Cash: cash,
@ -76,7 +76,7 @@ type NormalDistribution struct {
* Draw implements Distribution.
*/
func (n *NormalDistribution) Draw() (float64, bool) {
return n.Rand.NormFloat64() * n.StdDev + n.Mean, true
return n.Rand.NormFloat64()*n.StdDev + n.Mean, true
}
/**
@ -88,7 +88,7 @@ type ConstDistribution float64
* Draw implements Distribution.
*/
func (c ConstDistribution) Draw() (float64, bool) {
return (float64)c, true
return float64(c), true
}
/**