示例#1
0
文件: suabm.go 项目: pciet/suabm
// TODO: definitely need some tests on this one
func (a HomogenizedPileSet) Add(p Pile) HomogenizedPileSet {
	if store.TypedSet(a).Has(p) {
		e := store.TypedSet(a).Get(p).(Pile)
		e.Count = e.Count + p.Count
		return HomogenizedPileSet(store.TypedSet(a).Update(e)) // TODO: cost of these typecasts?
	}
	return HomogenizedPileSet(store.TypedSet(a).Add(p))
}
示例#2
0
文件: suabm.go 项目: pciet/suabm
// Will there be any changes on a call to Decay()?
func (a HomogenizedPileSet) DecayStable() bool {
	if (store.TypedSet(a).Get(Pile{Type: U}).(Pile).Count > 7) ||
		(store.TypedSet(a).Get(Pile{Type: A}).(Pile).Count > 3) ||
		(store.TypedSet(a).Get(Pile{Type: B}).(Pile).Count > 1) {
		return false
	} else {
		return true
	}
}
示例#3
0
文件: suabm.go 项目: pciet/suabm
func (a HomogenizedPileSet) MCount() uint {
	return store.TypedSet(a).Get(Pile{Type: M}).(Pile).Count
}