Perplexity Sudoku
Last update:October 27, 2026
Category:Games
License:MIT License
Version:0.0.1
Description
Sudoku Flask Game
A complete Sudoku web application built with Flask backend and JavaScript frontend, featuring SQLite database storage for game persistence.
Features
- Multiple Difficulty Levels: Easy, Medium, and Hard
- Database Persistence: All games are saved to SQLite database
- Session Management: Track games per user session
- Real-time Validation: Instant feedback on moves
- Timer: Track time spent on each puzzle
- Save/Load Games: Resume games anytime
- Auto-save: Games are automatically saved after each move
- Hint System: Get help when stuck
- Responsive Design: Works on desktop and mobile
Installation
Clone or download the files
Install dependencies:
pip install -r requirements.txtRun the application:
python run.pyOpen your browser and visit:
http://127.0.0.1:5000
API Endpoints
POST /api/new-game- Create a new Sudoku puzzleGET /api/game/<id>- Load a specific gamePUT /api/game/<id>- Save game progressGET /api/games- List user's saved gamesPOST /api/validate- Validate current board state
Database Schema
The application uses SQLite with the following table:
CREATE TABLE sudoku_game (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_session_id VARCHAR(100) NOT NULL,
board_state TEXT NOT NULL,
original_puzzle TEXT NOT NULL,
difficulty VARCHAR(20) NOT NULL,
is_complete BOOLEAN DEFAULT FALSE,
time_spent INTEGER DEFAULT 0,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
How to Play
- Choose Difficulty: Select Easy (40 filled), Medium (32 filled), or Hard (26 filled)
- Fill the Grid: Click cells and enter numbers 1-9
- Follow Sudoku Rules: Each row, column, and 3×3 box must contain digits 1-9
- Get Hints: Click hint button for valid numbers in selected cell
- Save Progress: Games auto-save, or manually save anytime
- Load Games: View and resume saved games from the sidebar
Technical Details
- Backend: Flask with SQLAlchemy ORM
- Database: SQLite for persistence
- Frontend: Vanilla JavaScript with modern ES6+ features
- Styling: Custom CSS with responsive design
- Session Management: Flask sessions for user tracking
- CORS: Enabled for API access
- Game Logic: Complete Sudoku generation and validation
File Structure
sudoku_flask_app/
├── app.py # Main Flask application
├── run.py # Application runner
├── requirements.txt # Python dependencies
├── templates/
│ └── index.html # Main HTML template
└── static/
├── css/
│ └── style.css # Stylesheet
└── js/
└── sudoku.js # JavaScript game logic
Development
To extend the application:
- Add new difficulty levels in
SudokuGeneratorclass - Implement user authentication for persistent user accounts
- Add multiplayer features with WebSocket support
- Create game statistics and progress tracking
- Add puzzle importing from external sources
Browser Compatibility
- Chrome/Edge 60+
- Firefox 55+
- Safari 12+
- Mobile browsers with ES6 support
Enjoy playing Sudoku!