class Chemystal::ReactionCollection

Overview

A Reaction Collection is a Hash from molecule names to an array of reactions having that molecule as part of their requirement

The idea behind this structure is that whenever a new molecule spawns, only the array of reactions requiring the new molecule will be searched for new reactions to occur

Defined in:

chemystal/chemical_machine/reaction_collection.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(spawner : Molecule -> Nil) #

[View source]

Instance Method Detail

def add_reaction(reaction : Reaction) #

Adds a reaction to the collection by adding it to all its requirements name entries


[View source]
def find_and_run_reaction(molecule_soup : MoleculeSoup, new_molecule_name : String | Nil) #

Runs all reactions on startup, or none or one reaction if responding to a new molecule


[View source]