Example #1
0
File: agent.go Project: elos/tyche
func NewAgent(name string, power int, auction *Auction) *Agent {
	return &Agent{
		Life:         autonomous.NewLife(),
		Stopper:      make(autonomous.Stopper),
		auction:      auction,
		stream:       make(Consumer),
		bettingPower: power,
		identifier:   data.ID(name),
	}
}
Example #2
0
func NewAuction() *Auction {
	pq := make(PriorityQueue, 0)
	heap.Init(&pq)

	return &Auction{
		Life:          autonomous.NewLife(),
		Stopper:       make(autonomous.Stopper),
		Leaders:       make(chan *Bid),
		PriorityQueue: &pq,
		Orders:        make(chan *Bid),
		Cancels:       make(chan string),
		books:         make(map[string]*Item),
	}
}