from Reaction import *


class Simulator:
	def __init__(self,crn):
		self.crn = crn
		self.simulationData = dict()
		self.crn.prepare()

		for chemical_name in self.crn.concentrations:
			self.simulationData[chemical_name] = []

	def addInSimulationData(self,concentrations):
		for chemical_name in concentrations:
			self.simulationData[chemical_name].append(concentrations[chemical_name])

	def simulate(self,timeSteps):
		print self.crn.concentrations
		self.addInSimulationData(self.crn.concentrations)
		for i in range(timeSteps):
			reaction = self.crn.getFastestReaction()
			if reaction != None:
				self.crn.doReaction(reaction)
			self.addInSimulationData(self.crn.concentrations)
			print self.crn.concentrations

		#for chemical_name in self.simulationData:
		#	print chemical_name,'-> ',self.simulationData[chemical_name]

		
				




@@ -16,16 +16,48 @@
 mport *%0A
+import matplotlib.pyplot as plt%0A
 %0A%0Aclass 
@@ -450,16 +450,17 @@
 eps):%0A%09%09
+#
 print se
@@ -720,16 +720,17 @@
 ons)%0A%09%09%09
+#
 print se
@@ -757,116 +757,224 @@
 s%0A%0A%09
-%09#for chemical_name in self.simulationData:%0A%09%09#%09print chemical_name,'-%3E ',self.simulationData%5Bchemical_name%5D
+def plot(self,listOfChemicals):%0A%09%09for chemical in listOfChemicals:%0A%09%09%09plt.plot(self.simulationData%5Bchemical%5D,label=chemical)%0A%09%09plt.ylabel('Concentration')%0A%09%09plt.xlabel('Time (unit time)')%0A%09%09plt.legend()%0A%09%09plt.show()%0A
 %0A%0A%09%09

Add plot method