puzzles.module
README.md
rewriteKit.puzzles
Multi-step code puzzles in the Software Whisper style, as data. A puzzle is a target and a list of steps; each step shows lines of code, some hidden until the player READs them, some rewritable with a list of options (a logic line is PATCHed whole). Picking the right option advances the step; a glitch option is rejected and costs extra, a crash option throws a full-screen SYSTEM ERROR and the step is retried; solving every step shows a results screen (actions, system errors, glitches, resource spent, time, 1 to 3 stars). Rewrite.definePuzzle(id, spec) registers one, Rewrite.playPuzzle(id, opts, onDone) plays it in any of the eight looks with keyboard (arrows, R read, E rewrite, Enter, Esc), gamepad (d-pad, X read, A rewrite, B exit) and touch (tap a line to select, tap again to READ, tap an option to choose, tap again to REWRITE). Four built-in kinds build a spec from a few fields: sequence (actions in a set order), fixBug (one faulty line among decoys), tune (a number into a safe band) and logicGate (flip inputs and patch the gate until the output is right). Puzzles.session(spec) is the pure state machine underneath, for a game's own UI or tests.