Refactored code to base.rb

Moved code that didn’t have to anything specific to do with each
application to a separate file base.rb. Now things that could just be
normal additions to base classes are there. Also a few ideas common
across the scripts are there (Integer#to_y)
Fan out is a set not a src->dst count

Changed fans to keep track of destinations as a set and then turn that
into an array for output.
Ignoring useless fanout

Unless a fanout is from a variable or has more than one destination,
then it’s not actually a fan out, it’s just something we were keeping
track of.
Added result order to layout output

Need to know how many integrators are used, for sure.