Commit Graph

19 Commits

Author SHA1 Message Date
Jose Luis
3bff1fd4b4 fix: allow dragging all gates + stop waveform recording on edits
- INPUT/CLOCK gates can now be dragged (click-without-move = toggle,
  click-and-drag = move). Uses 4px movement threshold.
- Waveform only records samples on intentional actions (INPUT toggle,
  manual step, simulation tick), not on gate placement/movement/connections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 02:42:00 +01:00
Jose Luis
3f1daa77bd feat: custom scrollbar + expand puzzle levels from 8 to 20
- Custom dark-themed scrollbar (WebKit + Firefox) matching the cyberpunk UI
- Added 12 new levels across new categories:
  - Combinational Logic: MUX, DEMUX, 3-input AND, Majority, Parity
  - Arithmetic: Half Subtractor, 1-bit Comparator
  - Decoders & Encoders: 2-to-4 Decoder, 4-to-2 Encoder, 7-Segment
  - Components: 1-bit ALU
  - Logic Basics: XNOR Gate

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 02:37:59 +01:00
Jose Luis
920a30ffa8 fix: puzzle sidebar integrates into layout instead of overlapping waveform
- Puzzle panel now shifts canvas and waveform viewer right (340px) instead of
  overlapping them, using body class toggle and CSS transitions
- Canvas resize accounts for sidebar width
- Progress (completed/unlocked levels, custom components) persists in localStorage
- Level cards refresh on each panel open to reflect current progress

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 02:32:35 +01:00
Jose Luis
b2e367817c feat: add Turing Complete-style puzzle system
Add progressive puzzle mode alongside the existing sandbox:
- 8 levels from basic gates to 2-bit adder
- Truth table verification with pass/fail feedback
- Gate restrictions per level
- Custom components system (save circuits as reusable chips)
- Save/load circuits as JSON
- Level selection sidebar with difficulty ratings
- Mode toggle: Sandbox (free play) vs Puzzle (guided levels)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 02:06:57 +01:00
Jose Luis Montañes
0f4fe27396 Revert to working waveform: timeStep += simSpeed, pxPerMs rendering
Restores the real-time ms-based waveform that correctly reflects
clock speed in wave width. Keeps the always-follow auto-scroll fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 22:43:24 +01:00
Jose Luis Montañes
fd1173e113 Fix waveform auto-scroll: always follow regardless of zoom level
Remove conditional that could skip scroll update when zooming.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 22:37:40 +01:00
Jose Luis Montañes
18c753cae1 Fix waveform: tick-based rendering + always-follow auto-scroll
- timeStep increments by 1 per tick (not by simSpeed ms)
- waveZoom = pixels per step directly (zoom changes wave width)
- Speed control only changes real-time interval between ticks
- Auto-scroll always follows latest data regardless of zoom level

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 22:35:41 +01:00
JosLe
6eb4b75446 Merge pull request 'Fix waveform: timeStep increments by 1 per tick, waveZoom = px/step' (#1) from master into main
Reviewed-on: #1
2026-03-19 21:32:49 +00:00
Jose Luis Montañes
93b8981418 Fix waveform: timeStep increments by 1 per tick, waveZoom = px/step
Each simulation tick now advances timeStep by 1 instead of by simSpeed ms.
waveZoom directly controls pixels per step, so changing clock speed
(the real-time interval) doesn't affect visual wave width, but zooming does.
This matches GTKWave behavior where the x-axis represents clock cycles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 22:18:45 +01:00
Jose Luis Montañes
c162adb1df feat: waveform uses real time (ms) - clock speed affects wave width
- Slow clock (1000ms) = wider pulses
- Fast clock (100ms) = narrower pulses
- Timeline shows ms/s labels
- Zoom controls scale the time axis
2026-03-19 22:13:41 +01:00
Jose Luis Montañes
d471b0adb3 fix: waveform zoom buttons - use 1.5x multiplier, show zoom level, remove wheel zoom 2026-03-19 22:10:44 +01:00
Jose Luis Montañes
7c58174f5f fix: remove alert(), fix waveform zoom, add waveform scroll (wheel + ctrl+wheel) 2026-03-19 22:08:26 +01:00
Jose Luis Montañes
d5de328898 feat: CLK toggles on Step, add pan/zoom (arrows, +/-, wheel, 0=reset) 2026-03-19 22:06:03 +01:00
Jose Luis Montañes
7409a96cf1 refactor: modularize into ES6 modules
Split monolithic index.html into:
- js/constants.js - gate config, colors, dimensions
- js/state.js     - shared application state
- js/gates.js     - evaluation logic, port geometry
- js/renderer.js  - canvas drawing
- js/waveform.js  - GTKWave-style signal viewer
- js/simulation.js - clock tick engine
- js/events.js    - mouse, keyboard, UI handlers
- js/app.js       - entry point
- css/style.css   - all styles
2026-03-19 22:00:02 +01:00
Jose Luis Montañes
aa97b37f0a trigger webhook 2026-03-19 19:44:41 +01:00
Jose Luis Montañes
6fbc6e4896 Add CLOCK gate with automatic simulation
- CLOCK gate auto-toggles 0→1→0 during simulation
- Run/Stop button in waveform toolbar
- Adjustable speed (50ms to 2000ms per tick)
- Click CLOCK to toggle manually when sim is stopped
- Waveform auto-opens when sim starts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 19:42:46 +01:00
Jose Luis Montañes
41f15c474b test: webhook auto-deploy 2026-03-19 19:37:42 +01:00
Jose Luis Montañes
a5ca5fdaa2 Add GTKWave-style waveform viewer
- Signal recording panel with per-gate waveforms
- Record/pause, step, zoom, clear controls
- Auto-scroll to latest signals
- Resizable panel with drag handle
- Color-coded signals matching gate types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 19:35:05 +01:00
Jose Luis Montañes
1f95b1a97a Initial commit: logic gate simulator 2026-03-19 18:37:39 +01:00