A sophisticated web application for solving the infamous Eternity II puzzle using a non-backtracking statistical solver with machine learning optimization. The app employs intelligent piece placement strategies and real-time performance analysis to tackle this notoriously difficult 16ร16 edge-matching puzzle.
- ๐งฉ Advanced Solving Algorithm: Non-backtracking statistical solver with weighted machine learning
- ๐ Real-time Analytics: Live performance tracking with detailed statistics
- ๐ฏ Machine Learning Optimization: Adaptive piece selection based on historical performance
- ๐พ State Persistence: Automatic saving and loading of solver progress
- ๐ CSV Import/Export: Backup and restore solver data with detailed statistics
- ๐จ Interactive Visualization: Animated 16ร16 puzzle board with color-coded edges
- โ๏ธ Configurable Parameters: Adjustable learning rates and calibration settings
- ๐ฑ Responsive Design: Works seamlessly on desktop and mobile devices
[Add screenshots of the application interface here]
- Frontend: React 18 + Vite
- Styling: Tailwind CSS + Custom UI Components
- Animation: Framer Motion
- UI Components: Radix UI (shadcn/ui pattern)
- State Management: React Context API + localStorage
- Icons: Lucide React
- Build Tool: Vite with hot module replacement
- Node.js 16.x or higher
- npm or yarn package manager
-
Clone the repository
git clone https://github.com/riplatt/Jigsaw-Genius.git cd e2-jigsaw-genius -
Install dependencies
npm install # or yarn install -
Start the development server
npm run dev # or yarn dev -
Open your browser Navigate to
http://localhost:5173to view the application.
npm run build
npm run preview- Start Solving: Click the "Start" button to begin the solving process
- Monitor Progress: Watch the real-time board updates and statistics
- Pause/Resume: Use the "Pause" button to stop and resume solving
- Reset: Clear all progress and start fresh with the "Reset" button
- Placement Strategy: Choose between Original Strategy or Optimized Strategy (25% faster with Diagonal Restriction)
- Learning Rate (k): Adjust how aggressively the solver favors high-scoring pieces (0.01-1.0)
- Calibration Mode: Enable/disable the 1000-run calibration period
- Performance Tracking: Monitor total runs, best scores, and completion rates
- CSV Export: Download comprehensive solver data including piece statistics
- CSV Import: Restore previous solving sessions and continue training
- Automatic Persistence: All progress is automatically saved to browser storage
The solver uses a non-backtracking statistical approach with the following key components:
- Configurable Placement Strategies: Choose between placement algorithms:
- Original Strategy: Standard placement order
- Optimized Strategy: 25% faster using Diagonal Restriction (Hints โ Orthogonal-Adjacent โ Diagonal Restriction โ Checkerboard โ Surrounded)
- Edge Validation: Ensures pieces fit by matching edge colors and border constraints
- Machine Learning Weighting: Uses exponential weighting based on historical performance
// Weight calculation for piece selection
weight = exp(k * (localAvgScore - globalAvgScore))- Calibration Phase: First 1000 runs establish baseline performance
- Adaptive Selection: Pieces with better historical performance get higher selection probability
- Continuous Learning: Statistics update after each solving attempt
- Board Size: 16ร16 (256 total pieces)
- Fixed Hints: 5 pre-placed pieces at specific positions
- Edge Colors: 23 different edge colors (0-22, where 0 = border)
- Rotations: Each piece can be rotated in 90ยฐ increments
src/
โโโ components/
โ โโโ puzzle/
โ โ โโโ SolverContext.jsx # Main solver logic and state
โ โ โโโ PuzzleBoard.jsx # Visual board component
โ โ โโโ SolverControls.jsx # Control panel
โ โ โโโ HintAnalysis.jsx # ML performance analysis
โ โโโ ui/ # Reusable UI components
โ โ โโโ button.jsx
โ โ โโโ slider.jsx
โ โ โโโ ...
โ โโโ Layout.jsx # Main application layout
โโโ pages/
โ โโโ Solver.jsx # Main solver page
โโโ config/
โ โโโ solver.js # Configuration constants
โโโ utils/
โ โโโ index.js # Utility functions
โโโ main.jsx # Application entry point
Located in src/config/solver.js:
export const SOLVER_CONFIG = {
BOARD_SIZE: 16,
TOTAL_PIECES: 256,
CALIBRATION_RUNS: 1000,
SOLVER_INTERVAL: 333, // milliseconds
// ... other configuration options
};- Solving Speed: Adjust
SOLVER_INTERVALfor faster/slower solving - Calibration Period: Modify
CALIBRATION_RUNSfor different training lengths - Animation Settings: Configure duration and delays for visual effects
The CSV export includes the following data:
| Column | Description |
|---|---|
| HintPosition | Position of the hint piece |
| Direction | Adjacent direction (north, east, south, west) |
| PieceId | ID of the puzzle piece |
| Rotation | Rotation angle (0, 90, 180, 270) |
| AvgScore | Average score for this piece/rotation |
| Count | Number of times this combination was used |
| BestScore | Best score achieved with this combination |
| SelectionPercentage | ML-calculated selection probability |
Additional solver state information:
- Total runs, best score, average score
- Completed solutions count
- Current run information
- ML parameters (weighting constant, calibration setting, placement strategy)
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and commit them:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Submit a pull request
- Follow React best practices and hooks patterns
- Use TypeScript for new components (optional)
- Maintain Tailwind CSS class organization
- Add comments for complex algorithm logic
- Test your changes thoroughly
- Use ES6+ features and functional components
- Follow the existing code structure and naming conventions
- Keep components focused and maintainable
- Use React.memo for performance optimization where appropriate
- Large datasets (>10,000 runs) may impact browser performance
- CSV import requires exact format matching
- Mobile performance may be limited for extended solving sessions
- Web Workers for parallel solving
- Advanced ML algorithms (neural networks)
- Pattern recognition for common configurations
- Backtracking option for dead-end recovery
- Multiple solving strategy comparison
- 3D visualization mode
- Tournament mode for strategy comparison
- Regular Exports: Save your progress frequently using CSV export
- Browser Resources: Close other tabs for better performance during long runs
- Learning Rate: Start with lower values (0.1-0.3) for more stable learning
- Calibration: Allow the full 1000-run calibration for optimal ML performance
- Eternity II Puzzle creators for the original challenge
- React and Vite teams for excellent development tools
- Tailwind CSS for the utility-first styling approach
- Radix UI for accessible component primitives
This project is licensed under the MIT License - see the LICENSE file for details.
- Project Repository: https://github.com/riplatt/Jigsaw-Genius
- Issues: https://github.com/riplatt/Jigsaw-Genius/issues
Made with โค๏ธ for puzzle enthusiasts and algorithm researchers