feat: implement real auto-solve that builds correct patches for all 96 levels
Replace the bypass auto-solve (which just set passed: true on all checks) with a legitimate solver that loads actual module configurations and connections via deserialize(), then validates through handleCheck(). Each solution defines the exact modules, parameters, and wiring needed to pass all 3-star checks for every level across all 12 worlds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import { playTarget, stopTarget, isTargetPlaying } from './targetAudio.js';
|
||||
import LevelComplete from './LevelComplete.jsx';
|
||||
import { completeLevel, saveLevelPatch, getLevelPatch, markHintUsed, wasHintUsed } from './gameState.js';
|
||||
import { playLevelComplete, playFail, playHint, playEngineStart, playEngineStop, playNav } from '../engine/uiSounds.js';
|
||||
import { SOLUTIONS } from './autoSolver.js';
|
||||
|
||||
export default function PuzzleView({ level, levelIndex, worldLevels, onBack, onNextLevel, adminMode }) {
|
||||
const [, forceUpdate] = useState(0);
|
||||
@@ -285,15 +286,20 @@ export default function PuzzleView({ level, levelIndex, worldLevels, onBack, onN
|
||||
}
|
||||
};
|
||||
|
||||
// Admin auto-solve — gives 3 stars instantly
|
||||
// Admin auto-solve — loads the actual solution modules/connections and validates naturally
|
||||
const handleAutoSolve = () => {
|
||||
const checks = level.checks.map(check => ({
|
||||
...check,
|
||||
passed: true,
|
||||
}));
|
||||
completeLevel(level.id, 3);
|
||||
setResult({ stars: 3, checks, hintPenalty: false });
|
||||
playLevelComplete();
|
||||
const solution = SOLUTIONS[level.id];
|
||||
if (!solution) {
|
||||
console.warn(`No auto-solve solution for level ${level.id}`);
|
||||
return;
|
||||
}
|
||||
// Load the solution patch into the engine state
|
||||
deserialize(solution);
|
||||
emit();
|
||||
// Now run the normal check logic against the loaded patch
|
||||
setTimeout(() => {
|
||||
handleCheck();
|
||||
}, 50);
|
||||
};
|
||||
|
||||
const isLastLevel = levelIndex >= worldLevels.length - 1;
|
||||
|
||||
1913
src/game/autoSolver.js
Normal file
1913
src/game/autoSolver.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user