\begin{tikzpicture}[node distance=1.5cm and 2cm] \node (start) [startstop] {Start: \texttt{record\_card()}}; \node (initlink) [process, below of=start] {Initialize \texttt{PcscLink}}; \node (card) [process, below of=initlink] {Create Card}; \node (clear) [process, below of=card] {Clear Card Memory}; \node (assignme) [process, below of=clear] {Assign Mutation Engine}; \node (loopscenarios) [process, below of=assignme] {For Each Scenario}; \node (initscenario) [process, below of=loopscenarios] {Instantiate Scenario}; \node (runscenario) [process, below of=initscenario] {Run \texttt{scenario.run(card)}}; \node (handlemut) [process, below of=runscenario] {Invoke Mutation \& Recording (see right)}; \node (exception) [decision, below of=handlemut] {Exception Raised?}; \node (markleaf) [process, left=2.5cm of exception] {Mark Node as Leaf}; \node (logfail) [process, right=2.5cm of exception] {Log + Record Failure}; \node (reset) [process, below of=logfail] {Reset Card + Recorder}; \node (check) [decision, below of=exception, yshift=-3cm] {All Mutations Tried?}; \node (savefile) [process, left=2.5cm of check] {Save Tree to File}; \node (loopagain) [process, right=2.5cm of check] {Loop Again}; \node (nextscenario) [process, below of=check] {Continue to Next Scenario}; \node (end) [startstop, below of=nextscenario] {End}; \draw [arrow] (start) -- (initlink); \draw [arrow] (initlink) -- (card); \draw [arrow] (card) -- (clear); \draw [arrow] (clear) -- (assignme); \draw [arrow] (assignme) -- (loopscenarios); \draw [arrow] (loopscenarios) -- (initscenario); \draw [arrow] (initscenario) -- (runscenario); \draw [arrow] (runscenario) -- (handlemut); \draw [arrow] (handlemut) -- (exception); \draw [arrow] (exception.west) -- node[above] {No} (markleaf.east); \draw [arrow] (exception.east) -- node[above] {Yes} (logfail.west); \draw [arrow] (logfail) -- (reset); \draw [arrow] (markleaf.south) |- (check.north); \draw [arrow] (reset.south) |- (check.north); \draw [arrow] (check.west) -- node[above] {Yes} (savefile.east); \draw [arrow] (check.east) -- node[above] {No} (loopagain.west); \draw [arrow] (savefile.south) |- (nextscenario); \draw [arrow] (loopagain.south) |- (nextscenario); \draw [arrow] (nextscenario) -- (end); \end{tikzpicture}