private AtomicCollection <IAtomic> CheckCompounds(AtomicCollection <IAtomic> experimentCollection) { foreach (var compound in Knowledge.KnownCompounds) { var result = CanChemistDoCompound(compound, experimentCollection); if (result != null) { var atomStack = new List <AtomStack>(); foreach (var iatomic in result) { atomStack.Add(new AtomStack(iatomic)); experimentCollection.Remove(iatomic); } Compound newCompound = new Compound(atomStack); LogEvents.CompoundGot(compound); CheckCompounds(experimentCollection); } } return(experimentCollection); }
private List <Ion> CheckIonCompounds(AtomicCollection <IAtomic> experimentCollection) { foreach (var compound in Knowledge.KnownIonCompounds.Keys) { var result = CanChemistDoCompound(compound, experimentCollection); if (result != null) { foreach (var atom in result) { experimentCollection.Remove(atom); } result.First().Electrons -= Knowledge.KnownIonCompounds[compound].Item1; result.Last().Electrons += Knowledge.KnownIonCompounds[compound].Item2; return(new List <Ion>(new Ion[] { new Ion(result.First()), new Ion(result.Last()) })); } } return(null); }