Exemple #1
0
class Universe:
    """Universe contains all fundamental particles and laws needed to get the universe to spin"""
    def __init__(self):
        self.moelcules = dict()
        cml = Cml.Reactions()
        cml.parse("data/reactions.cml")
        self.reactor = Reactor(cml.reactions)

    def react(self, reactants, effects):
        if len(reactants) < 2:
            return
        temp = 298
        effect_names = list()
        for effect in effects:
            effect_names.append(effect.name)
            if effect.supports("temp"):
                temp = effect.temp
        reaction = self.reactor.react(reactants, temp)

        if reaction == None:
            if Config.current.DEBUG: print("Did not react:", reactants)
            return None
        else:
            if Config.current.DEBUG:
                print(reaction.reactants, "+", effect_names, "->", reaction.products)
            return reaction
Exemple #2
0
class Universe:
    """Universe contains all fundamental particles and laws needed to get the universe to spin"""
    def __init__(self):
        self.moelcules = dict()
        cml = Cml.Reactions()
        cml.parse("data/reactions.cml")
        self.reactor = Reactor(cml.reactions)

    def react(self, reactants, effects):
        if len(reactants) < 2:
            return
        temp = 298
        effect_names = list()
        for effect in effects:
            effect_names.append(effect.name)
            if effect.supports("temp"):
                temp = effect.temp
        reaction = self.reactor.react(reactants, temp)

        if reaction == None:
            if Config.current.DEBUG: print("Did not react:", reactants)
            return None
        else:
            if Config.current.DEBUG:
                print(reaction.reactants, "+", effect_names, "->",
                      reaction.products)
            return reaction