# Logigate Logic circuit editor and simulator at , in the spirit of the game "Turing Complete". NAND is the only gate. You draw circuits with it, package them as components, and reuse those in bigger circuits, up to a CPU. Everything runs live while you draw: green wires carry a 1, grey wires a 0. Nuxt 4 (client-only, `ssr: false`), Tailwind CSS v4, Lucide icons via `@nuxt/icon`, Inter and JetBrains Mono self-hosted via `@nuxt/fonts`. No backend, no tracking: projects live in the browser's localStorage and can be exported as JSON. ## What it does - Parts: NAND, input switch, output pin, lamp, push button, clock, constant 1, ground, hex display, note. - Every circuit is a component. Its input and output nodes become its pins, ordered top to bottom. Double-click a component to open it. - Select parts and press "Make component" to turn them into a new component; wires crossing the selection become pins. - Gate symbols in IEC 60617 (DIN, default) or ANSI. A component with one output can be drawn as a gate symbol. - Truth table, NAND count, gate delay, and loop detection for the open circuit. - 17 challenges (NOT up to a D flip-flop) checked against a truth table or a step sequence. - Example library, all built from NAND: NOT, AND, OR, NOR, XOR, XNOR, Mux, Half/Full Adder, SR Latch, D Latch, D Flip-Flop, Register 4, Increment 4, Adder 4, Counter 4, and a counter demo with a hex display. ## How the simulation works All in [app/lib/logic/](app/lib/logic/), plain TypeScript with no Vue dependency: - `compile.ts` flattens the component tree into a list of NAND gates over numbered nets. Chip boundaries and pins are aliases, merged with union-find. Net 0 is constant 0, net 1 constant 1. - `sim.ts` is event-driven: a net change queues the gates that read it, and gates run in FIFO order on the newest values. NAND latches settle deterministically; a loop with an odd number of inversions never settles and the top bar shows "Oscillating". - Gate outputs are keyed by their path ("chipNode/chipNode/nand"), so latch state survives editing. - `analyze.ts` builds truth tables, counts NANDs, computes the longest gate path, and runs challenge tests. - `examples.ts` builds the example library with a small builder; `ops.ts` holds project edits (package selection, copy/paste, prune dangling wires, recursion check). The editor UI is in [app/components/editor/](app/components/editor/) with state in [app/composables/useEditor.ts](app/composables/useEditor.ts). ## Develop ```bash pnpm install pnpm dev # http://localhost:3000 pnpm test # engine tests (vitest) pnpm typecheck pnpm build # .output/ ``` ## Deploy Same pattern as autismus-spektrum. On edgerealm the repo lives in `/mnt/HC_Volume_102040804/srv/logigate`; run `./deploy.sh` there. It pulls, builds in a one-shot container and recreates the `logigate` container. Host nginx terminates TLS with the `*.blax.at` wildcard cert and forwards to Traefik, which routes `logicate.blax.at` and `logigate.blax.at` by the labels in [docker-compose.yml](docker-compose.yml).