// 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)) }
// 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 } }
func (a HomogenizedPileSet) MCount() uint { return store.TypedSet(a).Get(Pile{Type: M}).(Pile).Count }