Commit Graph

10 Commits

Author SHA1 Message Date
Jose Luis
d78b45841c fix: INPUT toggle no longer disrupts CLK timing in waveform
recordSample() (triggered by user INPUT toggle) now only advances
timeStep when the simulation is stopped. When sim is running, it
records at the current timeStep without advancing it, so the clock's
regular tick cadence is never stolen by manual interactions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 03:19:28 +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
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
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