def test_subtractSingleFromGroup(self): # basic examples a1 = util.rmvSt(['-N-Y-', '-N-NN'], 'NNNY-') self.assertEqual(a1[0], ["YN-Y-", 'NNYY-', '-N-NN']) self.assertEqual(a1[1], 2) # Results must be presented in minimal form. a2 = util.rmvSt(['N----', 'YN---'], '-Y---') self.assertEqual(a2[0], ['-N---']) self.assertEqual(a2[1], 8)
def calculatePerceived(self): """Calculate states perceived by the DM based on misperceptions.""" percDash = self.conflict.feasibles.dash for misp in self.misperceptions: res = gmcrUtil.rmvSt(percDash, misp.ynd()) percDash = res[0] misp.statesRemoved = res[1] toOrd = self.conflict.feasibles.toOrdered self.perceived = FeasibleList(percDash, toOrdered=toOrd) self.misperceived = [st for st in self.conflict.feasibles.ordered if st not in self.perceived.ordered]
def recalculateFeasibleStates(self, init_override=False): """Update all feasible state calculations.""" oldFeas = list(self.feasibles.decimal) feasDash = ['-' * len(self.options)] for infeas in self.infeasibles: res = gmcrUtil.rmvSt(feasDash, infeas.ynd()) feasDash = res[0] infeas.statesRemoved = res[1] self.feasibles = FeasibleList(feasDash) if self.feasibles.decimal != oldFeas: if not init_override: self.onFeasibleStatesChanged()