예제 #1
0
파일: agent.go 프로젝트: 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),
	}
}
예제 #2
0
파일: auction.go 프로젝트: elos/tyche
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),
	}
}