CCG & TCG Engine in AngularJS and Rails