Smart Book Maker is a powerful Python library and command-line tool for generating professional puzzle books. Create print-ready PDF books with customizable difficulty levels, adaptive puzzle counts, and professional layouts.
- π§© Multiple Puzzle Types: Generate Sudoku and Maze puzzles
- π Adaptive Difficulty: Automatically distributes puzzles across 5 difficulty levels
- π Custom Books: Create books with custom titles, puzzle counts, and themes
- π¨οΈ Print-Ready PDFs: Professional layouts suitable for publishing
- β‘ Easy CLI: Simple command-line interface for batch operations
- π§ Extensible: Well-structured codebase for adding new puzzle types
- π¨ Customizable: Configure book titles, difficulty distributions, and output
- Clone the repository:
git clone https://github.com/TheUnknown550/Smart-Book-Maker.git
cd Smart-Book-Maker- Install dependencies:
pip install -r requirements.txt- Test the installation:
python test_setup.pyπ‘ Quick Tip: Use the
allcommand for a complete workflow that generates puzzles AND creates a PDF book!
# Generate 100 Sudoku puzzles and create a complete book
python -m smart_book_maker.cli all sudoku --count 100
# Create a custom book with your own title
python -m smart_book_maker.cli all sudoku --count 50 --title "My Sudoku Collection" --subtitle "Custom Puzzles for Brain Training"# Generate 80 Maze puzzles and create a complete book
python -m smart_book_maker.cli all maze --count 80generate command creates puzzle files but does NOT create a PDF book!
# Generate only puzzles (no book created)
python -m smart_book_maker.cli generate sudoku --count 50
python -m smart_book_maker.cli generate maze --count 30
# Create book from existing puzzles (no new puzzles generated)
python -m smart_book_maker.cli create sudoku-book --total-puzzles 50
python -m smart_book_maker.cli create maze-bookThe CLI supports three main commands with different purposes:
| Command | Generates Puzzles | Creates PDF Book | Use Case |
|---|---|---|---|
generate |
β Yes | β No | Create puzzle files only |
create |
β No | β Yes | Make PDF from existing puzzles |
all |
β Yes | β Yes | Complete workflow (recommended) |
Creates puzzle/solution files but NO PDF book
# Generate Sudoku puzzles (files only)
python -m smart_book_maker.cli generate sudoku --count 100 --output-dir my_puzzles
# Generate Maze puzzles (files only)
python -m smart_book_maker.cli generate maze --count 50 --output-dir my_mazesCreates PDF book from existing puzzle files (does NOT generate new puzzles)
# Create Sudoku book with custom settings
python -m smart_book_maker.cli create sudoku-book \\
--output-dir my_puzzles \\
--filename "Custom_Sudoku_Book.pdf" \\
--title "Advanced Sudoku" \\
--subtitle "Challenge Your Mind" \\
--total-puzzles 100
# Create Maze book
python -m smart_book_maker.cli create maze-book \\
--output-dir my_mazes \\
--filename "My_Maze_Adventure.pdf"Generates puzzles AND creates PDF book in one command (recommended for most users)
# Complete Sudoku workflow with custom book
python -m smart_book_maker.cli all sudoku \\
--count 75 \\
--title "Brain Gym Sudoku" \\
--subtitle "75 Challenging Puzzles" \\
--filename "Brain_Gym_Sudoku.pdf"
# Complete Maze workflow
python -m smart_book_maker.cli all maze \\
--count 60 \\
--filename "Maze_Master_Challenge.pdf"from smart_book_maker.generators.sudoku import SudokuGenerator
from smart_book_maker.pdf.sudoku_book import SudokuBookPDF
# Generate individual puzzles
generator = SudokuGenerator()
puzzle, solution = generator.generate_puzzle(difficulty=25, total_puzzles=100)
# Create a custom book
book = SudokuBookPDF(
output_filename="My_Custom_Book.pdf",
book_title="Daily Sudoku",
book_subtitle="Perfect for Coffee Breaks",
total_puzzles=50
)
book.create_book("output/puzzles", "output/solutions")After running the tool, your files will be organized as follows:
output/
βββ puzzles/ # Sudoku puzzle images (.png)
βββ solutions/ # Sudoku solution images (.png)
βββ sudokus/ # Sudoku text files (.txt)
βββ mazes/ # Maze text files (.txt)
βββ mazes_png/ # Maze images (.png)
βββ books/ # Generated PDF books
βββ Complete_Sudoku_Puzzle_Book.pdf
βββ Complete_Maze_Puzzle_Book.pdf
Smart Book Maker automatically distributes puzzles across 5 difficulty levels based on your total puzzle count:
- Very Easy: 45-50 clues (great for beginners)
- Easy: 40-45 clues (building confidence)
- Medium: 32-40 clues (testing skills)
- Hard: 28-32 clues (challenging)
- Expert: 22-28 clues (master level)
- Very Easy: 5Γ5 grids
- Easy: 12Γ12 grids
- Medium: 20Γ20 grids
- Hard: 35Γ35 grids
- Very Hard: 50Γ50 grids
Example: If you generate 50 puzzles, you'll get 10 puzzles of each difficulty level. If you generate 100 puzzles, you'll get 20 of each level.
# Create a book with specific puzzle counts
from smart_book_maker.generators.sudoku import SudokuGenerator
generator = SudokuGenerator()
# Generate puzzles with custom total count
for i in range(1, 51): # 50 puzzles total
puzzle, solution = generator.generate_puzzle(i, total_puzzles=50)
difficulty = generator.get_difficulty_name(i, total_puzzles=50)
print(f"Puzzle {i}: {difficulty}")# Generate puzzles once
python -m smart_book_maker.cli generate sudoku --count 100
# Create multiple books with different titles
python -m smart_book_maker.cli create sudoku-book --title "Sudoku Volume 1" --filename "Volume1.pdf"
python -m smart_book_maker.cli create sudoku-book --title "Sudoku Volume 2" --filename "Volume2.pdf"# Run the setup test
python test_setup.py
# Run unit tests (if you have pytest installed)
python -m pytest tests/src/smart_book_maker/
βββ generators/ # Puzzle generation logic
βββ pdf/ # PDF book creation
βββ utils/ # Helper functions
βββ cli.py # Command-line interface
1. "No module named 'reportlab'" error
pip install reportlab pillow2. "Permission denied" when creating PDFs
- Make sure no PDF files are open in another program
- Check that you have write permissions to the output directory
3. Images not generating properly
- Ensure you have the Pillow library installed:
pip install pillow - Try running with a smaller puzzle count first
4. CLI not working
# Make sure you're in the project directory
cd Smart-Book-Maker
# Try running the module directly
python -m smart_book_maker.cli --help- Python: 3.7 or higher
- Dependencies:
pillowandreportlab(see requirements.txt) - Memory: 512MB+ RAM recommended for large books
- Storage: 1-100MB per book depending on puzzle count
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Add new puzzle types (Word Search, Crosswords, etc.)
- Improve puzzle generation algorithms
- Create new PDF layouts and themes
- Write tests and improve documentation
- Fix bugs and optimize performance
This project is licensed under the MIT License - see the LICENSE file for details.
python -m smart_book_maker.cli all sudoku \\
--count 25 \\
--title "Sudoku Starter Pack" \\
--subtitle "Perfect for Beginners" \\
--filename "Starter_Sudoku.pdf"python -m smart_book_maker.cli all maze \\
--count 200 \\
--filename "Ultimate_Maze_Challenge.pdf"# Generate a large set of puzzles
python -m smart_book_maker.cli generate sudoku --count 300
# Create themed books from the same puzzles
python -m smart_book_maker.cli create sudoku-book \\
--title "Morning Sudoku" \\
--subtitle "Start Your Day Right" \\
--total-puzzles 100 \\
--filename "Morning_Sudoku.pdf"
python -m smart_book_maker.cli create sudoku-book \\
--title "Evening Sudoku" \\
--subtitle "Relax and Unwind" \\
--total-puzzles 100 \\
--filename "Evening_Sudoku.pdf"Happy Puzzle Making! π§©π