Пример #1
0
//transmit von a nach b
func (m *Mover) Transmit(a, b *place.Place, ch chan bool) {
	for a.GetNumber() != m.favorit {
		time.Sleep(1)
		if b.Empty() {
			break
		}
	}
	m.transmitHelper(a, b)
	ch <- true
}
Пример #2
0
func (m *Mover) makePackage(a *place.Place) []*place.Object {
	var sum uint = 0
	var list []*place.Object
	list = make([]*place.Object, 0)
	if !a.Empty() {
		for sum+a.FirstElem().GetSize() <= 4 {
			sum += a.FirstElem().GetSize()
			list = append(list, a.Remove())
			if a.Empty() {
				break
			}
		}
	}
	return list
}