Draw circuits from NAND gates, package them as components and reuse them. Event-driven simulation runs live while drawing. IEC/ANSI symbols, truth tables, 17 challenges, example library up to a 4-bit counter. Deploys to edgerealm like autismus-spektrum (logicate.blax.at). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| app | ||
| public | ||
| tests | ||
| .dockerignore | ||
| .editorconfig | ||
| .env.example | ||
| .gitignore | ||
| Dockerfile.build | ||
| Dockerfile.serve | ||
| README.md | ||
| deploy.sh | ||
| docker-compose.yml | ||
| nuxt.config.ts | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| tsconfig.json | ||
| vitest.config.ts | ||
README.md
Logigate
Logic circuit editor and simulator at https://logicate.blax.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/, plain TypeScript with no Vue dependency:
compile.tsflattens 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.tsis 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.tsbuilds truth tables, counts NANDs, computes the longest gate path, and runs challenge tests.examples.tsbuilds the example library with a small builder;ops.tsholds project edits (package selection, copy/paste, prune dangling wires, recursion check).
The editor UI is in app/components/editor/ with state in app/composables/useEditor.ts.
Develop
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.