Hacker News new | ask | show | jobs
by laurentiurad 55 days ago
Thanks a lot!

I have created my own engine for testing the simulations in TypeScript. There is no external logic circuit library under the hood.

The simulation itself is tick-based with a light event-driven flavor. Each tick I compute an evaluation order using a topological sort of the circuit graph (based on wire connections). Then I iterate through components in that order, gathering inputs from connected wires. Each component runs an evaluate() function, producing outputs and a nextState. Outputs propagate through wires immediately within the same tick.