> Wonder if we can input the circuit as code.

SPICE. You're describing SPICE. :)