Go to file
Fabian @ Blax Software 03a4d55834 A logigate: NAND-only logic editor and simulator with components, challenges and examples
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>
2026-10-17 12:49:38 +02:00
app A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
public A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
tests A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
.dockerignore A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
.editorconfig A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
.env.example A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
.gitignore A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
Dockerfile.build A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
Dockerfile.serve A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
README.md A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
deploy.sh A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
docker-compose.yml A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
nuxt.config.ts A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
package.json A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
pnpm-lock.yaml A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
pnpm-workspace.yaml A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
tsconfig.json A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00
vitest.config.ts A logigate: NAND-only logic editor and simulator with components, challenges and examples 2026-10-17 12:49:38 +02:00

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.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/ 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.